Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1471679
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions |
| Date | 2016-08-29 11:50 +0200 |
| Message-ID | <sbrmx-5BR-7@gated-at.bofh.it> (permalink) |
| References | <s9YcW-6Yd-11@gated-at.bofh.it> <s9YcW-6Yd-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions Paolo Bonzini <pbonzini@redhat.com> - 2016-08-29 11:50 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 12:40 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions walter harms <wharms@bfs.de> - 2016-08-29 14:00 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions Paolo Bonzini <pbonzini@redhat.com> - 2016-08-29 18:50 +0200
csiph-web