提交 cfaa1181 编写于 作者: M Markus Elfring 提交者: Steve French

CIFS: Use memdup_user() rather than duplicating its implementation

Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

Generated by: scripts/coccinelle/api/memdup_user.cocci

Fixes: f5b05d62 ("cifs: add IOCTL for QUERY_INFO passthrough to userspace")
Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: NSteve French <stfrench@microsoft.com>
上级 acd4680e
......@@ -1402,15 +1402,10 @@ smb2_ioctl_query_info(const unsigned int xid,
if (smb3_encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ;
buffer = kmalloc(qi.output_buffer_length, GFP_KERNEL);
if (buffer == NULL)
return -ENOMEM;
if (copy_from_user(buffer, arg + sizeof(struct smb_query_info),
qi.output_buffer_length)) {
rc = -EFAULT;
goto iqinf_exit;
}
buffer = memdup_user(arg + sizeof(struct smb_query_info),
qi.output_buffer_length);
if (IS_ERR(buffer))
return PTR_ERR(buffer);
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册