lkml.org 
[lkml]   [2019]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] adfs: obj.file_id is uninitialized if __adfs_dir_get() returns error code
Date
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
\
 
 \ /
  Last update: 2019-08-29 07:35    [W:0.033 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site