]> git.karo-electronics.de Git - linux-beck.git/commitdiff
UBIFS: add a couple of extra asserts
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 25 Nov 2014 14:41:26 +0000 (16:41 +0200)
committerRichard Weinberger <richard@nod.at>
Wed, 28 Jan 2015 15:09:32 +0000 (16:09 +0100)
... to catch possible memory corruptions.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
fs/ubifs/debug.c

index 7ed13e1e216a8978e3a9a11be9bad29b50126103..4cfb3e82c56f2f8b8f841fad4b6f1ea908605084 100644 (file)
@@ -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.
@@ -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;