mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: parport: Use kmemdup
@ 2013-04-28 16:54 Alexandru Gheorghiu
  2013-05-17  1:21 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandru Gheorghiu @ 2013-04-28 16:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Wei Yongjun, linux-kernel, Alexandru Gheorghiu

Used kmemdup instead of kmalloc and memcpy.
Patch found using coccinelle.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
 drivers/parport/parport_gsc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 050773c..4b364c6 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -246,14 +246,14 @@ struct parport *parport_gsc_probe_port(unsigned long base,
 		printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base);
 		return NULL;
 	}
-	ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL);
+	ops = kmemdup(&parport_gsc_ops, sizeof(struct parport_operations),
+					GFP_KERNEL);
 	if (!ops) {
 		printk (KERN_DEBUG "parport (0x%lx): no memory for ops!\n",
 			base);
 		kfree (priv);
 		return NULL;
 	}
-	memcpy (ops, &parport_gsc_ops, sizeof (struct parport_operations));
 	priv->ctr = 0xc;
 	priv->ctr_writable = 0xff;
 	priv->dma_buf = 0;
-- 
1.7.9.5


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

* Re: [PATCH] drivers: parport: Use kmemdup
  2013-04-28 16:54 [PATCH] drivers: parport: Use kmemdup Alexandru Gheorghiu
@ 2013-05-17  1:21 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2013-05-17  1:21 UTC (permalink / raw)
  To: Alexandru Gheorghiu; +Cc: Wei Yongjun, linux-kernel

On Sun, Apr 28, 2013 at 07:54:38PM +0300, Alexandru Gheorghiu wrote:
> Used kmemdup instead of kmalloc and memcpy.
> Patch found using coccinelle.
> 
> Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
> ---
>  drivers/parport/parport_gsc.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

This patch doesn't apply to my tree, care to redo it and resend it?

thanks,

greg k-h

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

end of thread, other threads:[~2013-05-17  3:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-28 16:54 [PATCH] drivers: parport: Use kmemdup Alexandru Gheorghiu
2013-05-17  1:21 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome