aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/readinode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/readinode.c')
-rw-r--r--fs/jffs2/readinode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 9897f38af707..3833d74f2305 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1272,19 +1272,19 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
1272 jffs2_do_clear_inode(c, f); 1272 jffs2_do_clear_inode(c, f);
1273 return -ENAMETOOLONG; 1273 return -ENAMETOOLONG;
1274 } 1274 }
1275 f->target = kmalloc(je32_to_cpu(latest_node->csize) + 1, GFP_KERNEL); 1275 f->target = kmalloc(csize + 1, GFP_KERNEL);
1276 if (!f->target) { 1276 if (!f->target) {
1277 JFFS2_ERROR("can't allocate %d bytes of memory for the symlink target path cache\n", je32_to_cpu(latest_node->csize)); 1277 JFFS2_ERROR("can't allocate %u bytes of memory for the symlink target path cache\n", csize);
1278 mutex_unlock(&f->sem); 1278 mutex_unlock(&f->sem);
1279 jffs2_do_clear_inode(c, f); 1279 jffs2_do_clear_inode(c, f);
1280 return -ENOMEM; 1280 return -ENOMEM;
1281 } 1281 }
1282 1282
1283 ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node), 1283 ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node),
1284 je32_to_cpu(latest_node->csize), &retlen, (char *)f->target); 1284 csize, &retlen, (char *)f->target);
1285 1285
1286 if (ret || retlen != je32_to_cpu(latest_node->csize)) { 1286 if (ret || retlen != csize) {
1287 if (retlen != je32_to_cpu(latest_node->csize)) 1287 if (retlen != csize)
1288 ret = -EIO; 1288 ret = -EIO;
1289 kfree(f->target); 1289 kfree(f->target);
1290 f->target = NULL; 1290 f->target = NULL;
@@ -1293,7 +1293,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
1293 return ret; 1293 return ret;
1294 } 1294 }
1295 1295
1296 f->target[je32_to_cpu(latest_node->csize)] = '\0'; 1296 f->target[csize] = '\0';
1297 dbg_readinode("symlink's target '%s' cached\n", f->target); 1297 dbg_readinode("symlink's target '%s' cached\n", f->target);
1298 } 1298 }
1299 1299