Message ID | 20191127072210.30715-2-lee.jones@linaro.org |
---|---|
State | New |
Headers | show |
Series | [4.19,1/3] ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary | expand |
On Wed, Nov 27, 2019 at 07:22:09AM +0000, Lee Jones wrote: > From: Wen Yang <wen.yang99@zte.com.cn> > > [ Upstream commit 0f4bb10857e22a657e6c8cca5d1d54b641e94628 ] > > kmemdup has implemented the function that kmalloc() + memcpy(). > We prefer to kmemdup rather than code opened implementation. > > This issue was detected with the help of coccinelle. > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> > CC: Tomoki Sekiyama <tomoki.sekiyama@gmail.com> > CC: linux-kernel@vger.kernel.org > Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > --- > drivers/media/usb/siano/smsusb.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c > index 3071d9bc77f4..38ea773eac97 100644 > --- a/drivers/media/usb/siano/smsusb.c > +++ b/drivers/media/usb/siano/smsusb.c > @@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size) > return -ENOENT; > } > > - phdr = kmalloc(size, GFP_KERNEL); > + phdr = kmemdup(buffer, size, GFP_KERNEL); > if (!phdr) > return -ENOMEM; > - memcpy(phdr, buffer, size); > > pr_debug("sending %s(%d) size: %d\n", > smscore_translate_msg(phdr->msg_type), phdr->msg_type, > -- > 2.24.0 > Why does this patch qualify for stable inclusion?
On Wed, 27 Nov 2019, Greg KH wrote: > On Wed, Nov 27, 2019 at 07:22:09AM +0000, Lee Jones wrote: > > From: Wen Yang <wen.yang99@zte.com.cn> > > > > [ Upstream commit 0f4bb10857e22a657e6c8cca5d1d54b641e94628 ] > > > > kmemdup has implemented the function that kmalloc() + memcpy(). > > We prefer to kmemdup rather than code opened implementation. > > > > This issue was detected with the help of coccinelle. > > > > Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> > > CC: Tomoki Sekiyama <tomoki.sekiyama@gmail.com> > > CC: linux-kernel@vger.kernel.org > > Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> > > Signed-off-by: Lee Jones <lee.jones@linaro.org> > > --- > > drivers/media/usb/siano/smsusb.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c > > index 3071d9bc77f4..38ea773eac97 100644 > > --- a/drivers/media/usb/siano/smsusb.c > > +++ b/drivers/media/usb/siano/smsusb.c > > @@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size) > > return -ENOENT; > > } > > > > - phdr = kmalloc(size, GFP_KERNEL); > > + phdr = kmemdup(buffer, size, GFP_KERNEL); > > if (!phdr) > > return -ENOMEM; > > - memcpy(phdr, buffer, size); > > > > pr_debug("sending %s(%d) size: %d\n", > > smscore_translate_msg(phdr->msg_type), phdr->msg_type, > > Why does this patch qualify for stable inclusion? I'm guessing this question is rhetorical. :) Please drop the patch. -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 3071d9bc77f4..38ea773eac97 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size) return -ENOENT; } - phdr = kmalloc(size, GFP_KERNEL); + phdr = kmemdup(buffer, size, GFP_KERNEL); if (!phdr) return -ENOMEM; - memcpy(phdr, buffer, size); pr_debug("sending %s(%d) size: %d\n", smscore_translate_msg(phdr->msg_type), phdr->msg_type,