Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310202
b: refs/heads/master
c: b6778fd
h: refs/heads/master
v: v3
  • Loading branch information
Xi Wang authored and David Woodhouse committed May 14, 2012
1 parent 58b5ad1 commit 7906192
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7c80c352331a27cf0584f1701ed3a003984985f0
refs/heads/master: b6778fd7812d877abdbc78b9b2d4304150b2ce05
12 changes: 6 additions & 6 deletions trunk/fs/jffs2/readinode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,19 +1272,19 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
jffs2_do_clear_inode(c, f);
return -ENAMETOOLONG;
}
f->target = kmalloc(je32_to_cpu(latest_node->csize) + 1, GFP_KERNEL);
f->target = kmalloc(csize + 1, GFP_KERNEL);
if (!f->target) {
JFFS2_ERROR("can't allocate %d bytes of memory for the symlink target path cache\n", je32_to_cpu(latest_node->csize));
JFFS2_ERROR("can't allocate %u bytes of memory for the symlink target path cache\n", csize);
mutex_unlock(&f->sem);
jffs2_do_clear_inode(c, f);
return -ENOMEM;
}

ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node),
je32_to_cpu(latest_node->csize), &retlen, (char *)f->target);
csize, &retlen, (char *)f->target);

if (ret || retlen != je32_to_cpu(latest_node->csize)) {
if (retlen != je32_to_cpu(latest_node->csize))
if (ret || retlen != csize) {
if (retlen != csize)
ret = -EIO;
kfree(f->target);
f->target = NULL;
Expand All @@ -1293,7 +1293,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
return ret;
}

f->target[je32_to_cpu(latest_node->csize)] = '\0';
f->target[csize] = '\0';
dbg_readinode("symlink's target '%s' cached\n", f->target);
}

Expand Down

0 comments on commit 7906192

Please sign in to comment.