Re: [PATCH] ext4: fix possible non-initialized variable

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

 



> I'm afraid this doesn't fix it.  So now err is init to 0, but then:
> 
>         err = ext4_map_blocks(handle, inode, &map,
>                               create ? EXT4_GET_BLOCKS_CREATE : 0);
> 
> so err is immediately reset to whatever ext4_map_blocks returns, which might be 0.
> If so, we don't go down this case:
> 
>         if (err < 0)
>                 *errp = err;
> 
> and we do go down this case,
> 
>         if (err <= 0)
>                 return NULL;
> 
> in which case we return with *errp unset.
> 
> It needs something like this, though maybe this could be made prettier/clearer.
> 
> +	*errp = 0;
>  	if (err < 0)
>  		*errp = err;
>  	if (err <= 0)
>  		return NULL;
> -	*errp = 0;

Agreed. just initializing err variable into ext4_getblk() won't ensure *errp
will be filled with 'err' content. Thanks. I'll wait for some extra inputs and
see if is there anything else people have in mind, then release a v2 patch
-- 
--Carlos
--
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