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>
This commit is contained in:
parent
5558af16a0
commit
0ed375ebb1
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user