Skip to contentSkip to conversation

memstick: Cocci spatch "memdup.spatch"

PATCH New Thomas Meyer 1 participant 1 message Jun 1, 2013 Sony memorystick

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memstick: Cocci spatch "memdup.spatch"

---

drivers/memstick/core/mspro_block.c +1 -2
diff -u -p a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
@@ -1032,12 +1032,11 @@ static int mspro_block_read_attributes(s
 	}
 	msb->attr_group.name = "media_attributes";
 
-	buffer = kmalloc(attr_len, GFP_KERNEL);
+	buffer = kmemdup((char *)attr, attr_len, GFP_KERNEL);
 	if (!buffer) {
 		rc = -ENOMEM;
 		goto out_free_attr;
 	}
-	memcpy(buffer, (char *)attr, attr_len);
 
 	for (cnt = 0; cnt < attr_count; ++cnt) {
 		s_attr = kzalloc(sizeof(struct mspro_sys_attr), GFP_KERNEL);