[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4475e65d-415d-9cde-1fe1-c17e120849c4@redhat.com>
Date: Mon, 29 Aug 2016 11:47:38 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
sparclinux@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions
On 25/08/2016 10:22, SF Markus Elfring wrote:
> --- a/arch/sparc/kernel/led.c
> +++ b/arch/sparc/kernel/led.c
> @@ -69,7 +69,7 @@ static ssize_t led_proc_write(struct file *file, const char __user *buffer,
> if (count > LED_MAX_LENGTH)
> count = LED_MAX_LENGTH;
>
> - buf = kmalloc(sizeof(char) * (count + 1), GFP_KERNEL);
> + buf = kmalloc_array(count + 1, sizeof(*buf), GFP_KERNEL);
> if (!buf)
> return -ENOMEM;
>
Here it's probably best to just remove sizeof(char) completely, as it's
1 by definition.
Paolo
Powered by blists - more mailing lists