Skip to content

Commit

Permalink
UBIFS: add a couple of extra asserts
Browse files Browse the repository at this point in the history
... to catch possible memory corruptions.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Artem Bityutskiy authored and Richard Weinberger committed Jan 28, 2015
1 parent 0e707ae commit fb4325a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/ubifs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
long long blk_offs;
struct ubifs_data_node *dn = node;

ubifs_assert(zbr->len >= UBIFS_DATA_NODE_SZ);

/*
* Search the inode node this data node belongs to and insert
* it to the RB-tree of inodes.
Expand Down Expand Up @@ -2060,6 +2062,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
struct ubifs_dent_node *dent = node;
struct fsck_inode *fscki1;

ubifs_assert(zbr->len >= UBIFS_DENT_NODE_SZ);

err = ubifs_validate_entry(c, dent);
if (err)
goto out_dump;
Expand Down

0 comments on commit fb4325a

Please sign in to comment.