xfs
[Top] [All Lists]

[PATCH] 2.6.35.4: Fixed simple warning (array subscript is above array b

To: aelder@xxxxxxx
Subject: [PATCH] 2.6.35.4: Fixed simple warning (array subscript is above array bounds)
From: Poyo VL <poyo_vl@xxxxxxxxx>
Date: Thu, 2 Sep 2010 02:10:26 -0700 (PDT)
Cc: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1283418627; bh=/GXQ9hMYdp1mEw3vEGcq3KauFPyh8HNoTX5vCZe7UhQ=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6mLZIuAEEPgqaGTJsBPbFH7quTPnfueEVN5fkdiXVe1tIS+CAPbAvFFODvtB4y1Fo/I//T/ZOvBGQu6Um1m+g5A+kM/ftaLaEWZD6J8l3KEH3Ce5dQd6qwdmDydowOXvitvCtNin/jD1+9eprnaFiFYsmqHoJP511qyYnL7TU5w=
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=S/+kt6HHoKTL+XHdfmMXO3+FDiLp3M6hXMt/W68YTPZZrzbG5VWvWpvxofFJ+TtRN+iFlK0nH/smnb8Op2tR7k5QNQ36VHr/VKwJHqUPH8/q+C6fOO0hNGVaTsLuT3bHNxccvkFP8i/1IZ5kEdyfLJLGkL/4HormmktigOkINBM=;
From: Ionut Gabriel Popescu <poyo_vl@xxxxxxxxx>

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@xxxxxxxxx>
---

--- 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;




<Prev in Thread] Current Thread [Next in Thread>