public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.35.4: Fixed simple warning (array subscript is above array bounds)
@ 2010-09-02  9:10 Poyo VL
  2010-09-16 16:42 ` Alex Elder
  0 siblings, 1 reply; 3+ messages in thread
From: Poyo VL @ 2010-09-02  9:10 UTC (permalink / raw)
  To: aelder; +Cc: xfs

From: Ionut Gabriel Popescu <poyo_vl@yahoo.com>

When I tried to compile, I got the following warning:
fs/xfs/xfs_dir2_block.c: In function ‘xfs_dir2_sf_to_block’:
fs/xfs/xfs_dir2_block.c:1153:26: warning: array subscript is above array bounds
The code (fs/xfs/xfs_dir2_block.c line 1153) is:
dep->name[0] = dep->name[1] = '.';
dep is a pointer to a xfs_dir2_data_entry_t structure where name is defined as:
__u8            name[1];    /* name bytes, no null */
So it is a single element array, name[0] not also name[1] so I got that warning.
Patching is a simple replacement of 1 with 2.

Signed-off-by: Ionut Gabriel Popescu <poyo_vl@yahoo.com>
---

--- a/fs/xfs/xfs_dir2_data.h    2010-09-02 11:13:11.632007536 +0300
+++ b/fs/xfs/xfs_dir2_data.h    2010-09-02 11:13:28.080006488 +0300
@@ -87,7 +87,7 @@
 typedef struct xfs_dir2_data_entry {
     __be64            inumber;    /* inode number */
     __u8            namelen;    /* name length */
-    __u8            name[1];    /* name bytes, no null */
+    __u8            name[2];    /* name bytes, no null */
                         /* variable offset */
     __be16            tag;        /* starting offset of us */
 } xfs_dir2_data_entry_t;


      

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2010-09-16 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02  9:10 [PATCH] 2.6.35.4: Fixed simple warning (array subscript is above array bounds) Poyo VL
2010-09-16 16:42 ` Alex Elder
2010-09-16 16:48   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox