Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

eCryptfs: Cocci spatch "memdup.spatch"

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>

authored by

Thomas Meyer and committed by
Tyler Hicks
fc8b14d3 e8193ce5

+1 -2
+1 -2
fs/ecryptfs/messaging.c
··· 247 247 goto unlock; 248 248 } 249 249 msg_size = (sizeof(*msg) + msg->data_len); 250 - msg_ctx->msg = kmalloc(msg_size, GFP_KERNEL); 250 + msg_ctx->msg = kmemdup(msg, msg_size, GFP_KERNEL); 251 251 if (!msg_ctx->msg) { 252 252 rc = -ENOMEM; 253 253 printk(KERN_ERR "%s: Failed to allocate [%zd] bytes of " 254 254 "GFP_KERNEL memory\n", __func__, msg_size); 255 255 goto unlock; 256 256 } 257 - memcpy(msg_ctx->msg, msg, msg_size); 258 257 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_DONE; 259 258 wake_up_process(msg_ctx->task); 260 259 rc = 0;