Commit f30bd298 authored by YueHaibing's avatar YueHaibing Committed by Greg Kroah-Hartman

staging: exfat: Use kmemdup in exfat_symlink()

Use kmemdup rather than duplicating its implementation
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190905030047.88401-1-yuehaibing@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 981cdf7d
...@@ -2706,12 +2706,11 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, ...@@ -2706,12 +2706,11 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
/* timestamp is already written, so mark_inode_dirty() is unneeded. */ /* timestamp is already written, so mark_inode_dirty() is unneeded. */
EXFAT_I(inode)->target = kmalloc(len+1, GFP_KERNEL); EXFAT_I(inode)->target = kmemdup(target, len + 1, GFP_KERNEL);
if (!EXFAT_I(inode)->target) { if (!EXFAT_I(inode)->target) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
memcpy(EXFAT_I(inode)->target, target, len+1);
dentry->d_time = GET_IVERSION(dentry->d_parent->d_inode); dentry->d_time = GET_IVERSION(dentry->d_parent->d_inode);
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment