* [PATCH] fs: dlm: Use kmemdup
@ 2013-03-25 21:19 ` Alexandru Gheorghiu
0 siblings, 0 replies; 2+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-25 21:19 UTC (permalink / raw)
To: Christine Caulfield
Cc: David Teigland, cluster-devel, linux-kernel, Alexandru Gheorghiu
Use kmemdup instead of kmalloc followed by memcpy.
Patch found using coccinelle.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
fs/dlm/lowcomms.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 4f5ad24..bfd6fbc 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1213,10 +1213,9 @@ static void init_local(void)
if (dlm_our_addr(&sas, i))
break;
- addr = kmalloc(sizeof(*addr), GFP_NOFS);
+ addr = kmemdup(&sas, sizeof(*addr), GFP_NOFS);
if (!addr)
break;
- memcpy(addr, &sas, sizeof(*addr));
dlm_local_addr[dlm_local_count++] = addr;
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] fs: dlm: Use kmemdup
@ 2013-03-25 21:19 ` Alexandru Gheorghiu
0 siblings, 0 replies; 2+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-25 21:19 UTC (permalink / raw)
To: cluster-devel.redhat.com
Use kmemdup instead of kmalloc followed by memcpy.
Patch found using coccinelle.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
fs/dlm/lowcomms.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 4f5ad24..bfd6fbc 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1213,10 +1213,9 @@ static void init_local(void)
if (dlm_our_addr(&sas, i))
break;
- addr = kmalloc(sizeof(*addr), GFP_NOFS);
+ addr = kmemdup(&sas, sizeof(*addr), GFP_NOFS);
if (!addr)
break;
- memcpy(addr, &sas, sizeof(*addr));
dlm_local_addr[dlm_local_count++] = addr;
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-26 23:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 21:19 [PATCH] fs: dlm: Use kmemdup Alexandru Gheorghiu
2013-03-25 21:19 ` [Cluster-devel] " Alexandru Gheorghiu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.