mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 19:59:34 -04:00
Staging: rdma: Use memdup_user
Use memdup_user when user data is immediately copied into the allocated region. Issue found using coccinelle. Signed-off-by: Ksenija Stanojevic<ksenija.stanojevic@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
514d4d744d
commit
4ecc4a18d9
@@ -195,16 +195,9 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tmp = kmalloc(count, GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (copy_from_user(tmp, buf, count)) {
|
||||
ret = -EFAULT;
|
||||
goto bail_tmp;
|
||||
}
|
||||
tmp = memdup_user(buf, count);
|
||||
if (IS_ERR(tmp))
|
||||
return PTR_ERR(tmp);
|
||||
|
||||
dd = file_inode(file)->i_private;
|
||||
if (ipath_eeprom_write(dd, pos, tmp, count)) {
|
||||
|
||||
Reference in New Issue
Block a user