[U-Boot] fat.c:707: warning: array subscript is above array bounds

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Dec 13 23:22:25 CET 2008


On 23:13 Sat 13 Dec     , Wolfgang Denk wrote:
> Hello,
> 
> building U-Boot with recent toolchains (like GCC-4.3.2) results in
> this warning:
> 
> fat.c: In function 'read_bootsectandvi':
> fat.c:707: warning: array subscript is above array bounds
> 
> The respective code looks like this:
> 
> fs/fat/fat.c:
> 
>  705         /* Terminate fs_type string. Writing past the end of vistart
>  706            is ok - it's just the buffer. */
>  707         vistart->fs_type[8] = '\0';

why not do something like this

	*(vistart + sizeof(volume_info)) = '\0';

Best Regards,
J.


More information about the U-Boot mailing list