hfs: Fix uninitialized value issue in hfs_iget
Subsystems (2)
PATCH 1/1 hfs: Fix uninitialized value issue in hfs_iget
Fix uninitialized value issue in hfs_iget by initializing the hfs_cat_rec structure in hfs_lookup.
--- fs/hfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/dir.c +1 -1
@@ -20,7 +20,7 @@static struct dentry *hfs_lookup (struct inode *dir,struct dentry *dentry,unsigned int flags) { -hfs_cat_rec rec; +hfs_cat_rec rec = {0 };struct hfs_find_data fd;struct inode *inode =NULL ;int res;
Signature · 1 line
2.34.1
Quoted 16 lines · On 23/09/24 23:30, SurajSonawane2415 wrote:
Fix uninitialized value issue in
hfs_igetby initializing thehfs_cat_recstructure inhfs_lookup.Reported-by [email protected]Tested-by [email protected]Signed-off-by SurajSonawane2415 <[email protected]>--- fs/hfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/hfs/dir.c +0
-0
fs/hfs/dir.c line 26
Quoted 8 lines
fs/hfs/dir.c +1
-1@@ -20,7 +20,7 @@static struct dentry *hfs_lookup (struct inode *dir,struct dentry *dentry,unsigned int flags) { -hfs_cat_rec rec; +hfs_cat_rec rec = {0 };struct hfs_find_data fd;struct inode *inode =NULL ;int res;
I wanted to follow up on the patch I submitted. I was wondering if you had a chance to review it and if there are any comments or feedback.
Thank you for your time and consideration. I look forward to your response.
Best regards,
Suraj Sonawane
Quoted 3 lines · Suraj Sonawane
Quoted 2 lines · On 23/09/24 23:30, SurajSonawane2415 wrote:
Fix uninitialized value issue in
hfs_igetby initializing thehfs_cat_recstructure inhfs_lookup.
This doesn't make sense to me. I don't see how we get to hfs_iget() with an uninit "rec".
hfs_cat_rec rec;
...
res = hfs_brec_read(&fd, &rec, sizeof(rec));
if (res) {
...
} else {
inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);Unless there's a path in hfs_brec_read() which returns 'success' while not actually filling in all of 'rec', in which case that's the bug which needs to be fixed.