fat: fix fat_ra_init() for data clusters == 0
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Wed, 12 Aug 2020 01:36:01 +0000 (18:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:49:07 +0000 (11:49 +0200)
commit796f99a7b77a79087b5654715082088c57de8d46
tree46f4070d949510a455e27817db6df2efe2e15d9e
parentf358706be43a2cb7f4a188dbb30d5272588a1f86
fat: fix fat_ra_init() for data clusters == 0

[ Upstream commit a090a5a7d73f79a9ae2dcc6e60d89bfc6864a65a ]

If data clusters == 0, fat_ra_init() calls the ->ent_blocknr() for the
cluster beyond ->max_clusters.

This checks the limit before initialization to suppress the warning.

Reported-by: syzbot+756199124937b31a9b7e@syzkaller.appspotmail.com
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/87mu462sv4.fsf@mail.parknet.co.jp
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/fat/fatent.c