summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2014-11-25 15:41:26 +0100
committerRichard Weinberger <richard@nod.at>2015-01-28 16:09:32 +0100
commitfb4325a3d9f983160f142b919880ccbe2304bc25 (patch)
treeb30d730e5fdb0482f71f2738536e41d5bdc90feb /fs/ubifs
parentUBI: do propagate positive error codes up (diff)
downloadlinux-fb4325a3d9f983160f142b919880ccbe2304bc25.tar.xz
linux-fb4325a3d9f983160f142b919880ccbe2304bc25.zip
UBIFS: add a couple of extra asserts
... to catch possible memory corruptions. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/debug.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 7ed13e1e216a..4cfb3e82c56f 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -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;