Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1428764ybm; Thu, 23 May 2019 00:30:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA/4FuHXKci8nkFCrUnfQrkR5+IO6HnEgsry1b4inWN0//s3PZb+gaDtQUAL2+3T+aMI9r X-Received: by 2002:a17:902:e492:: with SMTP id cj18mr37700529plb.341.1558596633116; Thu, 23 May 2019 00:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558596633; cv=none; d=google.com; s=arc-20160816; b=Jo9ruG88QsRuGPxl4J6JyyXQ0IpCCEsLasU+PlvZFktCVI4M9iLgJTPQs3HvqKJRy1 swGPQtMdHq6gKIURfvziaY1cn+Mv/JyBXyeXucX2d2vtsz/QmVOu6zQRjhWtElyJEnJR DF8JT1GUw9cOIQp9cMGgr0LjFCSYSZndcQhLc+n5OerZGCkNk90+sRIWeUVw4AGJiZ0i Vpo58YRtrCZujLGVKrGuvm9wEfaHRfahB/Lw6Kmq1OKnO4ntmcLa2Xz9jjOGvZq8pT/Z 4vQVDqGkrGrHdAgKiZnMhD1WVGKc8UCClusYrqTaT8mPaIhw9uuq1Qqrrns8MkvYbiJL 4izg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=y0ndvATBuFeBuD1aCpeFBhYVI+2u7k6MGm7Va98zHq8=; b=rKisTFUgz3ns+BVjjoD4SCyib4xyK9wWy0Sbb7EEglco85P/dvJTIhB08+5LNev08T RgO5lTAjq4G/pGAnYLviPadDsYHaRz2C2OLN6CqnqlHwdvoFFii7+iCylv4RCNDcuhn7 BJef9klqW6A0xqMxIsaB/MqjxVCl5BEby+XSLr4WGkNE1H49YOyuWgv69VKa02Em/oyV gydt4X9LftJvE54BvjXYWHcQjBrTxXvh/jnqtQIeei+iXYW2yHttE6u5MijFhvrb6ZR+ XvSaqa6if9RVZZtns4NeYRK90o/2mekjKeGmAsfOXv4W/rlojB64RD1FjIxImpXQmmnI xEVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=dDhplhtn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23si17053915pgi.269.2019.05.23.00.30.13; Thu, 23 May 2019 00:30:33 -0700 (PDT) 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; dkim=pass header.i=@c-s.fr header.s=mail header.b=dDhplhtn; 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 S1729897AbfEWH07 (ORCPT + 99 others); Thu, 23 May 2019 03:26:59 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:47349 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729781AbfEWH05 (ORCPT ); Thu, 23 May 2019 03:26:57 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 458gzy1zmFz9v23W; Thu, 23 May 2019 09:26:54 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=dDhplhtn; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id r_mYKpjo8VNy; Thu, 23 May 2019 09:26:54 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 458gzy033Rz9v23V; Thu, 23 May 2019 09:26:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1558596414; bh=y0ndvATBuFeBuD1aCpeFBhYVI+2u7k6MGm7Va98zHq8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=dDhplhtnXkzFY/ATEefKFa2nsAnGJkFilJI74ov27kmHlMUaYVqU2Yxn1PJggw1Vj FkFqdInH5+TEbZ+tQDPPc0vCpF9mximrMFysWuEUbDnaXQ7f06B4xd7JakVWPonEGa wdcYmuMjpWQyeXrTcfQbk+m6N0tQz5rFZ/nS/qV4= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 032218B77D; Thu, 23 May 2019 09:26:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mYH4J9Ejz9ZD; Thu, 23 May 2019 09:26:54 +0200 (CEST) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0E6578B75A; Thu, 23 May 2019 09:26:54 +0200 (CEST) Subject: Re: [PATCH] powerpc/powernv: fix variable "c" set but not used To: Qian Cai , benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20190523023141.2973-1-cai@lca.pw> From: Christophe Leroy Message-ID: Date: Thu, 23 May 2019 09:26:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190523023141.2973-1-cai@lca.pw> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 23/05/2019 à 04:31, Qian Cai a écrit : > The commit 58629c0dc349 ("powerpc/powernv/npu: Fault user page into the > hypervisor's pagetable") introduced a variable "c" to be used in > __get_user() and __get_user_nocheck() which need to stay as macros for > performance reasons, and "c" is not actually used in > pnv_npu2_handle_fault(), > > arch/powerpc/platforms/powernv/npu-dma.c: In function 'pnv_npu2_handle_fault': > arch/powerpc/platforms/powernv/npu-dma.c:1122:7: warning: variable 'c' > set but not used [-Wunused-but-set-variable] > > Fixed it by appending the __maybe_unused attribute, so compilers would > ignore it. You are not fixing the problem, you are just hiding it. If the result of __get_user() is unneeded, it means __get_user() is not the good function to use. Should use fault_in_pages_readable() instead. A similar warning was fixed in commit 9f9eae5ce717 ("powerpc/kvm: Prefer fault_in_pages_readable function") See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/powerpc?id=9f9eae5ce > > Signed-off-by: Qian Cai You should add a Fixes: tag 58629c0dc349 ("powerpc/powernv/npu: Fault user page into the hypervisor's pagetable") Christophe > --- > arch/powerpc/platforms/powernv/npu-dma.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c > index 495550432f3d..5bbe59573ee6 100644 > --- a/arch/powerpc/platforms/powernv/npu-dma.c > +++ b/arch/powerpc/platforms/powernv/npu-dma.c > @@ -1119,7 +1119,8 @@ int pnv_npu2_handle_fault(struct npu_context *context, uintptr_t *ea, > int i, is_write; > struct page *page[1]; > const char __user *u; > - char c; > + /* To silence a -Wunused-but-set-variable warning. */ > + char c __maybe_unused; > > /* mmap_sem should be held so the struct_mm must be present */ > struct mm_struct *mm = context->mm; >