summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-23 21:13:51 +0200
committerTom Rini <trini@konsulko.com>2020-09-29 13:19:08 -0400
commit0ed375ebb13f8b2d69400b9df8985c8123d3fbb1 (patch)
tree8af5723bec9fc6523fc95750dd0885f4dbe2edd8 /fs
parent5558af16a01d992f32051d96b55c3625d10899c4 (diff)
fs/squashfs: parameter check sqfs_read_metablock()
We should check if the incoming parameter file_mapping is not NULL instead of checking after adding an offset. Reported-by: Coverity CID 307210 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/squashfs/sqfs_inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
index 1368f3063c..14d70cf678 100644
--- a/fs/squashfs/sqfs_inode.c
+++ b/fs/squashfs/sqfs_inode.c
@@ -141,9 +141,9 @@ int sqfs_read_metablock(unsigned char *file_mapping, int offset,
const unsigned char *data;
u16 header;
- data = file_mapping + offset;
- if (!data)
+ if (!file_mapping)
return -EFAULT;
+ data = file_mapping + offset;
header = get_unaligned((u16 *)data);
if (!header)