summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/sqfs_inode.c
diff options
context:
space:
mode:
authorJoao Marcos Costa <jmcosta944@gmail.com>2020-09-11 12:21:06 +0200
committerTom Rini <trini@konsulko.com>2020-09-18 16:19:58 -0400
commita7dc37d38c8eddcd14008b115e254279bb88bbc1 (patch)
treef8012a5c1c4d67df08489404bad2c53686c043ea /fs/squashfs/sqfs_inode.c
parent98f3ee09d096c6c1bc49e08d805f6354dffb0e59 (diff)
downloadu-boot-a7dc37d38c8eddcd14008b115e254279bb88bbc1.tar.gz
u-boot-a7dc37d38c8eddcd14008b115e254279bb88bbc1.tar.xz
u-boot-a7dc37d38c8eddcd14008b115e254279bb88bbc1.zip
fs/squashfs: Fix Coverity Scan defects
Fix control flow issues and null pointer dereferences. Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Diffstat (limited to 'fs/squashfs/sqfs_inode.c')
-rw-r--r--fs/squashfs/sqfs_inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
index 1387779a85..1368f3063c 100644
--- a/fs/squashfs/sqfs_inode.c
+++ b/fs/squashfs/sqfs_inode.c
@@ -142,8 +142,11 @@ int sqfs_read_metablock(unsigned char *file_mapping, int offset,
u16 header;
data = file_mapping + offset;
+ if (!data)
+ return -EFAULT;
+
header = get_unaligned((u16 *)data);
- if (!header || !data)
+ if (!header)
return -EINVAL;
*compressed = SQFS_COMPRESSED_METADATA(header);