lkml.org 
[lkml]   [2022]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] file: Added pointer check
Date
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.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
fs/affs/file.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index d91b0133d95d..4566fa767f65 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -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;
--
2.25.1
\
 
 \ /
  Last update: 2022-11-15 14:10    [W:0.077 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site