Re: fs/ufs/inode.c:817: warning: array subscript is above array bounds



On Wed, 31 Jan 2007 23:10:57 +0300
"Tomasz Kvarsin" <kvarsin@xxxxxxxxx> wrote:

d binderman wrote:
Hello there,

I just tried to compile Linux kernel 2.6.19.2 with the
new GNU C compiler version 4.3 snapshot 20070126.

The compiler said

fs/ufs/inode.c:817: warning: array subscript is above array bounds

The source code is

for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++)
ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.i_data[i];

but

./include/linux/ufs_fs.h: __fs32 ui_db[UFS_NDADDR];/*
0x28 data blocks */
./include/linux/ufs_fs.h: __fs64
ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */

and

__fs32 i_data[15];

and

#define UFS_NDADDR 12
#define UFS_NINDIR 3

so the kernel seems to be trying to write fifteen bytes into an array only
twelve
bytes in size. Suggest code rework.


As I see, linux-kernel is very high volume(noise?) list,
may better wil be resend to relevant mantainer(Andrew Morton?)

Evgeniy, please consider raising a patch against ./MAINTAINERS ;)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: GPL vs non-GPL device drivers
    ... shipped the source code of the modified POP server. ... given you the compiler he compiled it with, ... Actually, if memory serves, when you license a work under the GPL, part of the ... a derivative work" the claim is invalid - because, as it has been shown, a ...
    (Linux-Kernel)
  • Re: more compiler switches
    ... Also print the version number of the compiler ... driver program and of the preprocessor and the compiler proper. ... C source code which should not be preprocessed. ... Like -v except the commands are not executed and all command arguments are ...
    (comp.lang.fortran)
  • Re: Dad upgrade.
    ... If the source code is available in full, the job of compiling it is very ... end of it, you do just hit the `go' button on the compiler, and out pops ... neither is any good without some hardware to store it and execute it - ... program will be happily translated into machine code for whatever CPU ...
    (uk.comp.sys.mac)
  • portable makefiles with f90 modules
    ... What is the current status of designing portable makefiles (on ... unix-like OSs and beyond) in large programming projects with f90 ... I'm assuming in a large project that source code is spread across ... files (or whatever they happen to be called by that compiler). ...
    (comp.lang.fortran)
  • Re: Richard Stallman is responsible for the shrinking economy
    ... there are still _some_ reasons and I've experienced them. ... Having access to the source code is an insurance policy. ... the then-fastest/best c compiler was used (Lattice c) ... compiler was used. ...
    (comp.arch.embedded)