A call to FAT_getblk is missing a null return check which can
lead to a null pointer dereference. Fix this by adding a null
check to match all the other FAT_getblk return sanity checks.
Addresses-Coverity: ("Dereference null return")
Fixes: c48c9f7ff32b ("staging: exfat: add exfat filesystem code to staging")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20190830175050.12706-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
FAT_modify(sb, sec);
fat_sector = FAT_getblk(sb, ++sec);
+ if (!fat_sector)
+ return -1;
fat_sector[0] = (u8)((fat_sector[0] & 0xF0) |
(content >> 8));
} else {