diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-09-23 21:13:51 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-09-29 13:19:08 -0400 |
commit | 0ed375ebb13f8b2d69400b9df8985c8123d3fbb1 (patch) | |
tree | 8af5723bec9fc6523fc95750dd0885f4dbe2edd8 /fs | |
parent | 5558af16a01d992f32051d96b55c3625d10899c4 (diff) | |
download | u-boot-0ed375ebb13f8b2d69400b9df8985c8123d3fbb1.zip u-boot-0ed375ebb13f8b2d69400b9df8985c8123d3fbb1.tar.gz u-boot-0ed375ebb13f8b2d69400b9df8985c8123d3fbb1.tar.bz2 |
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c index 1368f30..14d70cf 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) |