[Bug 30872] Calling kfree() for uninitialized pointer in ext4_mb_init_backend()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=30872





--- Comment #3 from Eugene A. Shatokhin <dame_eugene@xxxxxxx>  2011-03-14 20:08:27 ---
(In reply to comment #2)
> I sent a patch here:
> http://marc.info/?l=linux-ext4&m=129979820301087&w=2
> which initializes all the pointers to NULL and only frees if they are non-NULL, 
> which may be more foolproof, but might also be overkill.

As far as I can see, it is not overkill. 

On the system where I observed the problem, 'i' began from 12
('num_meta_group_infos' was 12, the total number of groups to be initialized).
But only the first two elements of the sbi->s_group_info array were actually
initialized. So without setting the remaining pointers to NULL, 
    while (--i >= 0)
        kfree(sbi->s_group_info[i]);
would still result in an oops when it attempted to kfree()
sbi->s_group_info[11].

Apart from that, checking if the pointer is not NULL before kfree() could
probably be omitted in the patch as kfree(NULL) is a no-op anyway. But still,
it is a matter of coding style and personal preference.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux