diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-08-24 10:50:15 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-08-27 17:05:14 +0300 |
commit | 8c83a4851da1c7eda83098ade238665b15774da3 (patch) | |
tree | c77fc57022d29785537bf4effe8fa2499d64afde /fs/ntfs3/index.c | |
parent | 04810f000afdbdd37825ca7f563f036119422cb7 (diff) | |
download | linux-8c83a4851da1c7eda83098ade238665b15774da3.tar.xz |
fs/ntfs3: Potential NULL dereference in hdr_find_split()
The "e" pointer is dereferenced before it has been checked for NULL.
Move the dereference after the NULL check to prevent an Oops.
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/index.c')
-rw-r--r-- | fs/ntfs3/index.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 5fb41c9c8910..f4729aa50671 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -557,11 +557,12 @@ static const struct NTFS_DE *hdr_find_split(const struct INDEX_HDR *hdr) size_t o; const struct NTFS_DE *e = hdr_first_de(hdr); u32 used_2 = le32_to_cpu(hdr->used) >> 1; - u16 esize = le16_to_cpu(e->size); + u16 esize; if (!e || de_is_last(e)) return NULL; + esize = le16_to_cpu(e->size); for (o = le32_to_cpu(hdr->de_off) + esize; o < used_2; o += esize) { const struct NTFS_DE *p = e; |