linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adfs: obj.file_id is uninitialized if __adfs_dir_get() returns error code
@ 2019-08-29  5:35 Yizhuo
  0 siblings, 0 replies; only message in thread
From: Yizhuo @ 2019-08-29  5:35 UTC (permalink / raw)
  Cc: csong, zhiyunq, Yizhuo, linux-kernel

Inside function adfs_dir_find_entry(), obj.file_id could be uninitialized
if __adfs_dir_get() returns error code. However, the return check cannot
promise the initialization of obj.file_id, which is used in the if
statement. This is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
---
 fs/adfs/dir_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index 0fbfd0b04ae0..d7fc47598e78 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -335,7 +335,7 @@ adfs_dir_find_entry(struct adfs_dir *dir, unsigned long object_id)
 	ret = -ENOENT;
 
 	for (pos = 5; pos < ADFS_NUM_DIR_ENTRIES * 26 + 5; pos += 26) {
-		struct object_info obj;
+		struct object_info obj = {};
 
 		if (!__adfs_dir_get(dir, pos, &obj))
 			break;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-29  5:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  5:35 [PATCH] adfs: obj.file_id is uninitialized if __adfs_dir_get() returns error code Yizhuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).