Commit 0ed375eb authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Tom Rini
Browse files

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: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
parent 5558af16
...@@ -141,9 +141,9 @@ int sqfs_read_metablock(unsigned char *file_mapping, int offset, ...@@ -141,9 +141,9 @@ int sqfs_read_metablock(unsigned char *file_mapping, int offset,
const unsigned char *data; const unsigned char *data;
u16 header; u16 header;
data = file_mapping + offset; if (!file_mapping)
if (!data)
return -EFAULT; return -EFAULT;
data = file_mapping + offset;
header = get_unaligned((u16 *)data); header = get_unaligned((u16 *)data);
if (!header) if (!header)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment