summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/sqfs_inode.c
diff options
context:
space:
mode:
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);