rapidio/rio_cm: use memdup_user() instead of duplicating code
PATCH 58/102 rapidio/rio_cm: use memdup_user() instead of duplicating code
From: Alexandre Bounine <[email protected]>
Subject: rapidio/rio_cm: use memdup_user() instead of duplicating code
Fix coccinelle warning about duplicating existing memdup_user function.
Signed-off-by Alexandre Bounine <[email protected]>
Reported-by kbuild test robot <[email protected]>
Cc Matt Porter <[email protected]>
Cc Andre van Herk <[email protected]>
Cc Barry Wood <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/rapidio/rio_cm.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/rapidio/rio_cm.c renamed from drivers/rapidio/rio_cm.c~rapidio-rio_cm-use-memdup_user-instead-of-duplicating-code +1 -4
@@ -1841,24 +1841,19 @@ static int cm_chan_msg_send(void __user {struct rio_cm_msg msg;void *buf; -int ret =0 ; +int ret;if (copy_from_user (&msg, arg,sizeof (msg)))return -EFAULT ;if (msg.size >RIO_MAX_MSG_SIZE )return -EINVAL ; - buf =kmalloc (msg.size,GFP_KERNEL ); -if (!buf) -return -ENOMEM ;