From patchwork Tue Feb 9 12:00:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 61518 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1997751lbl; Tue, 9 Feb 2016 04:01:10 -0800 (PST) X-Received: by 10.66.132.81 with SMTP id os17mr48982972pab.98.1455019270028; Tue, 09 Feb 2016 04:01:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si53711861pfi.213.2016.02.09.04.01.09; Tue, 09 Feb 2016 04:01:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756204AbcBIMBH (ORCPT + 30 others); Tue, 9 Feb 2016 07:01:07 -0500 Received: from foss.arm.com ([217.140.101.70]:39884 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755852AbcBIMBD (ORCPT ); Tue, 9 Feb 2016 07:01:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4CFE63A1; Tue, 9 Feb 2016 04:00:16 -0800 (PST) Received: from leverpostej (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 52A353F238; Tue, 9 Feb 2016 04:01:01 -0800 (PST) Date: Tue, 9 Feb 2016 12:00:33 +0000 From: Mark Rutland To: Sudip Mukherjee , Arnd Bergmann , Catalin Marinas Cc: Stephen Rothwell , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Jeremy Linton , linux-arch@vger.kernel.org, Laura Abbott Subject: Re: linux-next: Tree for Feb 9 Message-ID: <20160209120032.GB19840@leverpostej> References: <20160209164104.4ecaa0ce@canb.auug.org.au> <20160209073428.GA24863@sudip-pc> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160209073428.GA24863@sudip-pc> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Feb 09, 2016 at 01:04:28PM +0530, Sudip Mukherjee wrote: > On Tue, Feb 09, 2016 at 04:41:04PM +1100, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20160208: > > tilepro, tilegx, mips defconfig build fails with the error: > ../include/asm-generic/fixmap.h: In function '__set_fixmap_offset': > ../include/asm-generic/fixmap.h:77:2: error: implicit declaration of > function '__set_fixmap' [-Werror=implicit-function-declaration] > > caused by: > commit ac4c0ac73485 ("asm-generic: make __set_fixmap_offset a static inline") > > Reverting the commit fixes the issue. Sorry about this. Is seems any arch without its own __set_fixmap may be adversely affected. I can't easily stub __set_fixmap as it's not implemented as a macro. I think we can stick with a macro and remove 'addr', by returning the result of the expression directly. As fix_to_virt gave us an unsigned long I think the types should line up (i.e. the result will be at least unsigned long wide). Arnd, would you be happy with the below patch instead? It builds fine for arm, arm64, mips, and tilegx in local testing. Thanks, Mark. ---->8---- >From d30ae6ebbae2c969ee36ef548711493b64c2be41 Mon Sep 17 00:00:00 2001 From: Mark Rutland Date: Tue, 9 Feb 2016 11:43:55 +0000 Subject: [PATCH] asm-generic: Avoid variable in __set_fixmap_offset Currently __set_fixmap_offset is a macro function which has a local variable called 'addr'. If a caller passes a 'phys' parameter which is derived from a variable also called 'addr', the local variable will shadow this, and the compiler will complain about the use of an uninitialized variable. It is likely that fixmap users may use the name 'addr' for variables that may be directly passed to __set_fixmap_offset, or that may be indirectly generated via other macros. Rather than placing the burden on callers to avoid the name 'addr', this patch removes the temporary 'addr' variable in __set_fixmap_offset, directly returning the result of the address calculation. Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Arnd Bergmann Cc: Catalin Marinas Cc: Jeremy Linton Cc: Laura Abbott Cc: Sudip Mukherjee --- include/asm-generic/fixmap.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 1.9.1 Signed-off-by: Mark Rutland Reported-by: Sudip Mukherjee diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index 1cbb833..ae2cc43 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -72,10 +72,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) /* Return a pointer with offset calculated */ #define __set_fixmap_offset(idx, phys, flags) \ ({ \ - unsigned long addr; \ __set_fixmap(idx, phys, flags); \ - addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ - addr; \ + fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ }) #define set_fixmap_offset(idx, phys) \