LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: fs/ufs/inode.c:817: warning: array subscript is above array bounds
@ 2007-01-31 20:10 Tomasz Kvarsin
  2007-01-31 21:24 ` Andrew Morton
  2007-01-31 21:27 ` Randy Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Tomasz Kvarsin @ 2007-01-31 20:10 UTC (permalink / raw)
  To: Andrew Morton, dcb314; +Cc: linux-kernel

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?)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: fs/ufs/inode.c:817: warning: array subscript is above array bounds
  2007-01-31 20:10 fs/ufs/inode.c:817: warning: array subscript is above array bounds Tomasz Kvarsin
@ 2007-01-31 21:24 ` Andrew Morton
  2007-02-01 20:55   ` Evgeniy Dushistov
  2007-01-31 21:27 ` Randy Dunlap
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2007-01-31 21:24 UTC (permalink / raw)
  To: Tomasz Kvarsin; +Cc: dcb314, linux-kernel, Evgeniy Dushistov

On Wed, 31 Jan 2007 23:10:57 +0300
"Tomasz Kvarsin" <kvarsin@gmail.com> 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 ;)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: fs/ufs/inode.c:817: warning: array subscript is above array bounds
  2007-01-31 20:10 fs/ufs/inode.c:817: warning: array subscript is above array bounds Tomasz Kvarsin
  2007-01-31 21:24 ` Andrew Morton
@ 2007-01-31 21:27 ` Randy Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2007-01-31 21:27 UTC (permalink / raw)
  To: Tomasz Kvarsin; +Cc: Andrew Morton, dcb314, linux-kernel, dushistov

On Wed, 31 Jan 2007 23:10:57 +0300 Tomasz Kvarsin 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?)

UFS doesn't have a known maintainer in the MAINTAINERS file.
The last big patcher of it is:
  Evgeniy Dushistov <dushistov@mail.ru>


---
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: fs/ufs/inode.c:817: warning: array subscript is above array bounds
  2007-01-31 21:24 ` Andrew Morton
@ 2007-02-01 20:55   ` Evgeniy Dushistov
  0 siblings, 0 replies; 5+ messages in thread
From: Evgeniy Dushistov @ 2007-02-01 20:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tomasz Kvarsin, dcb314, linux-kernel

On Wed, Jan 31, 2007 at 01:24:32PM -0800, Andrew Morton wrote:
> On Wed, 31 Jan 2007 23:10:57 +0300
> "Tomasz Kvarsin" <kvarsin@gmail.com> 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.

Actually, this is not a _real_ bug,
yes, 
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++)
	ufs_inode->ui_u2.ui_addr.ui_db[i]

and ui_db only ui_db[UFS_NDADDR], but if look on more high level,
then:
union {
struct {
     __fs64     ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
      __fs64     ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
} ui_addr;
} ui_u2;

have no idea, why array splited on two parts,
may be some macros used this feature.

-- 
/Evgeniy


^ permalink raw reply	[flat|nested] 5+ messages in thread

* fs/ufs/inode.c:817: warning: array subscript is above array bounds
@ 2007-01-31  9:08 d binderman
  0 siblings, 0 replies; 5+ messages in thread
From: d binderman @ 2007-01-31  9:08 UTC (permalink / raw)
  To: linux-kernel


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.


Regards

David Binderman

_________________________________________________________________
Find Love This New Year With match.com! http://msnuk.match.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-02-01 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-31 20:10 fs/ufs/inode.c:817: warning: array subscript is above array bounds Tomasz Kvarsin
2007-01-31 21:24 ` Andrew Morton
2007-02-01 20:55   ` Evgeniy Dushistov
2007-01-31 21:27 ` Randy Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2007-01-31  9:08 d binderman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).