From patchwork Thu Oct 11 13:20:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 1582061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 62CB53FD9C for ; Thu, 11 Oct 2012 13:22:06 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMIga-00072s-Lo; Thu, 11 Oct 2012 13:20:24 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMIgW-00071g-Ul for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 13:20:22 +0000 Received: from klappe2.localnet (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0M8n1M-1TEdia0ZEy-00CDN9; Thu, 11 Oct 2012 15:20:04 +0200 From: Arnd Bergmann To: Al Viro Subject: [PATCH v2] vfs: bogus warnings in fs/namei.c Date: Thu, 11 Oct 2012 13:20:00 +0000 User-Agent: KMail/1.12.2 (Linux/3.5.0; KDE/4.3.2; x86_64; ; ) References: <1349448930-23976-1-git-send-email-arnd@arndb.de> <201210091307.19225.arnd@arndb.de> <20121011043734.GE2616@ZenIV.linux.org.uk> In-Reply-To: <20121011043734.GE2616@ZenIV.linux.org.uk> MIME-Version: 1.0 Message-Id: <201210111320.01047.arnd@arndb.de> X-Provags-ID: V02:K0:vLFwG6SVYnmFvRGFlhwGxIM2UOzYY/UVCu6ipTQwa5z N26GqWNNLRQdshrd1Yr2L85LR0/YjECBv2RAKuzeYw3Y+1NfzR kTbeR4uL+iCYx9W3N1yVm56twmZo3iSCi5lMGSp/9tIzN3S6UZ f7Co9orCiR1YkUBH8ePeFjMZKSs+RHtAA+H6pcOweVl3fhC9CN kP2zWfOptY44cdmqrYO/sWv9RN1rof2S2xBLR39jqrMtfIg07p pbO8ujXm9STgIsIxmf6lSZwRkZg9s9OkGhjC3uIvHuzoZZrfGp cbLOTURllZISOg/vIpDu02YK0LY8AhZ8bAuu3sll25gaMKFI5C UuEwsKzCKnozrvYLVBJA= X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.9 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-fsdevel@vger.kernel.org, arm@kernel.org, Jan Kara , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The follow_link() function always initializes its *p argument, or returns an error, but when building with 'gcc -s', the compiler gets confused by the __always_inline attribute to the function and can no longer detect where the cookie was initialized. The solution is to always initialize the pointer from follow_link, even in the error path. When building with -O2, this has zero impact on generated code and adds a single instruction in the error path for a -Os build on ARM. Without this patch, building with gcc-4.6 through gcc-4.8 and CONFIG_CC_OPTIMIZE_FOR_SIZE results in: fs/namei.c: In function 'link_path_walk': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:1544:9: note: 'cookie' was declared here fs/namei.c: In function 'path_lookupat': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:1934:10: note: 'cookie' was declared here fs/namei.c: In function 'path_openat': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:2899:9: note: 'cookie' was declared here Signed-off-by: Arnd Bergmann diff --git a/fs/namei.c b/fs/namei.c index 6d47fac..c1f18e4 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -810,6 +810,7 @@ follow_link(struct path *link, struct nameidata *nd, void **p) return error; out_put_nd_path: + *p = NULL; path_put(&nd->path); path_put(link); return error;