diff options
Diffstat (limited to 'fs/jffs2/dir.c')
-rw-r--r-- | fs/jffs2/dir.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 79121aa5858b..92978658ed18 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -367,7 +367,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
367 | } | 367 | } |
368 | 368 | ||
369 | /* We use f->target field to store the target path. */ | 369 | /* We use f->target field to store the target path. */ |
370 | f->target = kmalloc(targetlen + 1, GFP_KERNEL); | 370 | f->target = kmemdup(target, targetlen + 1, GFP_KERNEL); |
371 | if (!f->target) { | 371 | if (!f->target) { |
372 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); | 372 | printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); |
373 | mutex_unlock(&f->sem); | 373 | mutex_unlock(&f->sem); |
@@ -376,7 +376,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
376 | goto fail; | 376 | goto fail; |
377 | } | 377 | } |
378 | 378 | ||
379 | memcpy(f->target, target, targetlen + 1); | ||
380 | D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); | 379 | D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); |
381 | 380 | ||
382 | /* No data here. Only a metadata node, which will be | 381 | /* No data here. Only a metadata node, which will be |