[U-Boot] [PATCH v2] ext2fs: fix warning: 'blocknxt' may be used uninitialized

Jason Cooper u-boot at lakedaemon.net
Fri Jul 6 15:31:25 CEST 2012


On Tue, Jul 03, 2012 at 05:41:56PM -0500, Kim Phillips wrote:
> This warning was introduced in 436da3c "ext2load: increase read
> speed":
> 
> ext2fs.c: In function 'ext2fs_read_file':
> ext2fs.c:458:19: warning: 'blocknxt' may be used uninitialized in this function [-Wuninitialized]
> 
> this change makes it go away.
> 
> Cc: Eric Nelson <eric.nelson at boundarydevices.com>
> Cc: Thierry Reding <thierry.reding at avionic-design.de>
> Cc: Jason Cooper <u-boot at lakedaemon.net>
> Cc: Andreas Bießmann <andreas.devel at googlemail.com>
> Cc: Reinhard Arlt <reinhard.arlt at esd-electronics.com>
> Signed-off-by: Kim Phillips <kim.phillips at freescale.com>

Acked-By: Jason Cooper <u-boot at lakedaemon.net>

thx,

Jason.

> ---
> v2: changed to Thierry's recommendation in:
> 
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/134043
> 
> build-tested only - please ack
> 
>  fs/ext2/ext2fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c
> index f1fce48..182f0ac 100644
> --- a/fs/ext2/ext2fs.c
> +++ b/fs/ext2/ext2fs.c
> @@ -438,7 +438,7 @@ int ext2fs_read_file
>  		}
>  
>  		/* grab middle blocks in one go */
> -		if (i != pos / blocksize && i != blockcnt - 1 && blockcnt > 3) {
> +		if (i != pos / blocksize && i < blockcnt - 1 && blockcnt > 3) {
>  			int oldblk = blknr;
>  			int blocknxt;
>  			while (i < blockcnt - 1) {
> -- 
> 1.7.11.1
> 
> 


More information about the U-Boot mailing list