2013-06-01 09:39:01

by Thomas Meyer

[permalink] [raw]
Subject: [PATCH] dlm: Cocci spatch "memdup.spatch"


Signed-off-by: Thomas Meyer <[email protected]>
---

diff -u -p a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
--- 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;
}
}