From patchwork Mon Nov 14 19:12:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9428277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C06D602F0 for ; Mon, 14 Nov 2016 19:12:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5C628816 for ; Mon, 14 Nov 2016 19:12:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 606D2288CF; Mon, 14 Nov 2016 19:12:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFF4728816 for ; Mon, 14 Nov 2016 19:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754188AbcKNTMS (ORCPT ); Mon, 14 Nov 2016 14:12:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38558 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754187AbcKNTMR (ORCPT ); Mon, 14 Nov 2016 14:12:17 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D8EE8E3E6; Mon, 14 Nov 2016 19:12:17 +0000 (UTC) Received: from tleilax.poochiereds.net (ovpn-116-49.rdu2.redhat.com [10.10.116.49]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAEJCG59007771; Mon, 14 Nov 2016 14:12:16 -0500 From: Jeff Layton To: linux-sparse@vger.kernel.org Cc: Al Viro Subject: [PATCH] Handle SForced in storage_modifiers Date: Mon, 14 Nov 2016 14:12:16 -0500 Message-Id: <1479150736-28392-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 14 Nov 2016 19:12:17 +0000 (UTC) Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Jeff Layton --- parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index 205e12644a6c..b290ff2636f2 100644 --- a/parse.c +++ b/parse.c @@ -1286,7 +1286,8 @@ static unsigned long storage_modifiers(struct decl_state *ctx) [SAuto] = MOD_AUTO, [SExtern] = MOD_EXTERN, [SStatic] = MOD_STATIC, - [SRegister] = MOD_REGISTER + [SRegister] = MOD_REGISTER, + [SForced] = 0 }; return mod[ctx->storage_class] | (ctx->is_inline ? MOD_INLINE : 0) | (ctx->is_tls ? MOD_TLS : 0);