[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230925044807.92037-1-suhui@nfschina.com>
Date: Mon, 25 Sep 2023 12:48:06 +0800
From: Su Hui <suhui@...china.com>
To: almaz.alexandrovich@...agon-software.com
Cc: Su Hui <suhui@...china.com>, ntfs3@...ts.linux.dev,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] fs/ntfs3: Avoid possible NULL dereference
smatch error:
fs/ntfs3/attrib.c:1826 attr_allocate_frame() error:
we previously assumed 'attr_b' could be null (see line 1739)
Return error code directly if 'attr_b' is NULL.
Signed-off-by: Su Hui <suhui@...china.com>
---
fs/ntfs3/attrib.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index a9d82bbb4729..ebc934ac5cf5 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -1737,8 +1737,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size,
attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,
0, NULL, &mi_b);
if (!attr_b) {
- err = -ENOENT;
- goto out;
+ return -ENOENT;
}
attr = attr_b;
--
2.30.2
Powered by blists - more mailing lists