Skip to contentSkip to conversation

hfs: Fix uninitialized value issue in hfs_iget

PATCH In review SurajSonawane2415 2 participants 3 messages Sep 23, 2024 – Nov 15, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index b75c26045df4..3b880b3e4b4c 100644
@@ -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
#1 lore raw
Quoted 16 lines · On 23/09/24 23:30, SurajSonawane2415 wrote:

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 +0 -0
index b75c26045df4..3b880b3e4b4c 100644

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

#2 lore raw
Quoted 3 lines · Suraj Sonawane
Quoted 2 lines · On 23/09/24 23:30, SurajSonawane2415 wrote:

Fix uninitialized value issue in hfs_iget by initializing the hfs_cat_rec structure in hfs_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.