Skip to contentSkip to conversation

file: Added pointer check

PATCH New Denis Arefev 1 participant 1 message Dec 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 file: Added pointer check

Return value of a function 'affs_bread' is dereferenced at file.c:970 without checking for null, but it is usually checked for this function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 fs/affs/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/affs/file.c +2 -0
index d91b0133d95d..4566fa767f65 100644
@@ -963,6 +963,8 @@ affs_truncate(struct inode *inode)
 
 	while (ext_key) {
 		ext_bh = affs_bread(sb, ext_key);
+		if (!ext_bh)
+			break;
 		size = AFFS_SB(sb)->s_hashsize;
 		if (size > blkcnt - blk)
 			size = blkcnt - blk;
Signature · 1 line
2.25.1