aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorJeff Layton <jlayton@redhat.com>2016-11-14 14:12:16 -0500
committerChristopher Li <sparse@chrisli.org>2016-11-17 00:17:16 +0800
commit1db3b627dfff5a6ab7a7af3259603eb0a10b45aa (patch)
tree875dd99e1156e55aee464f7303b6ede5020c0a15
parent6c283a05175c512e2d564753cd0b1a7bfc68c620 (diff)
downloadsparse-dev-1db3b627.tar.gz
Handle SForced in storage_modifiers
We have been seeing errors like this for a while now in the sparse Fedora package, when doing kernel builds: ./include/linux/err.h:53:25: warning: dereference of noderef expression ./include/linux/err.h:35:16: warning: dereference of noderef expression This spews all over the build because this comes from IS_ERR(), which is called everywhere. Even odder, it turns out that if we build the package with -fpic turned off, then it works fine. With some brute-force debugging, I think I've finally found the cause. This array is missing the SForced element. When this is added then the problem goes away. As to why this goes away when -fpic is removed, I can only assume that we get lucky with the memory layout and have a zeroed out region just beyond the end of the array. Fixes: 3829c4d8b097776e6b3472290a9fae08a705ab7a Cc: Al Viro <viro@ftp.linux.org.uk> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 205e1264..b52c6abe 100644
--- a/parse.c
+++ b/parse.c
@@ -105,7 +105,7 @@ enum {
};
enum {
- CInt = 0, CSInt, CUInt, CReal, CChar, CSChar, CUChar
+ CInt = 0, CSInt, CUInt, CReal, CChar, CSChar, CUChar, CMax,
};
enum {
@@ -1281,7 +1281,7 @@ static const char *storage_class[] =
static unsigned long storage_modifiers(struct decl_state *ctx)
{
- static unsigned long mod[] =
+ static unsigned long mod[CMax] =
{
[SAuto] = MOD_AUTO,
[SExtern] = MOD_EXTERN,