Re: [PATCH] hfs: Fix uninitialized value issue in hfs_iget

From: Matthew Wilcox
Date: Fri Nov 15 2024 - 12:03:35 EST


On Fri, Nov 15, 2024 at 09:22:31PM +0530, Suraj Sonawane wrote:
> 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.