linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI, APEI: fix using the correct variable for sizeof()
@ 2022-03-19 21:54 Jakob Koschel
  2022-03-22 17:53 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Jakob Koschel @ 2022-03-19 21:54 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jakob Koschel, linux-kernel, linux-acpi, Len Brown, James Morse,
	Tony Luck, Borislav Petkov, Mike Rapoport, Brian Johannesmeyer,
	Cristiano Giuffrida, Bos, H.J.

While the original code is valid, it is not the obvious choice for the
sizeof() call and in preparation to limit the scope of the list iterator
variable the sizeof should be changed to the size of the variable
being allocated.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
 drivers/acpi/apei/apei-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index c7fdb12c3310..33b7fbbeda82 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -319,7 +319,7 @@ static int apei_res_add(struct list_head *res_list,
 	if (res_ins)
 		list_add(&res_ins->list, res_list);
 	else {
-		res_ins = kmalloc(sizeof(*res), GFP_KERNEL);
+		res_ins = kmalloc(sizeof(*res_ins), GFP_KERNEL);
 		if (!res_ins)
 			return -ENOMEM;
 		res_ins->start = start;

base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI, APEI: fix using the correct variable for sizeof()
  2022-03-19 21:54 [PATCH] ACPI, APEI: fix using the correct variable for sizeof() Jakob Koschel
@ 2022-03-22 17:53 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2022-03-22 17:53 UTC (permalink / raw)
  To: Jakob Koschel
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List,
	ACPI Devel Maling List, Len Brown, James Morse, Tony Luck,
	Borislav Petkov, Mike Rapoport, Brian Johannesmeyer,
	Cristiano Giuffrida, Bos, H.J.

On Sat, Mar 19, 2022 at 10:55 PM Jakob Koschel <jakobkoschel@gmail.com> wrote:
>
> While the original code is valid, it is not the obvious choice for the
> sizeof() call and in preparation to limit the scope of the list iterator
> variable the sizeof should be changed to the size of the variable
> being allocated.
>
> Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
> ---
>  drivers/acpi/apei/apei-base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
> index c7fdb12c3310..33b7fbbeda82 100644
> --- a/drivers/acpi/apei/apei-base.c
> +++ b/drivers/acpi/apei/apei-base.c
> @@ -319,7 +319,7 @@ static int apei_res_add(struct list_head *res_list,
>         if (res_ins)
>                 list_add(&res_ins->list, res_list);
>         else {
> -               res_ins = kmalloc(sizeof(*res), GFP_KERNEL);
> +               res_ins = kmalloc(sizeof(*res_ins), GFP_KERNEL);
>                 if (!res_ins)
>                         return -ENOMEM;
>                 res_ins->start = start;
>
> base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
> --

Applied as 5.18-rc material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-22 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 21:54 [PATCH] ACPI, APEI: fix using the correct variable for sizeof() Jakob Koschel
2022-03-22 17:53 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).