Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6302180rwl; Thu, 29 Dec 2022 10:24:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsBt/DxW4UbMq7oXaQOYSvAfF01/2b8QPJ/vtSvF+L1sJVSAkTO2NiCdRwTeaHpTT7o1a8/ X-Received: by 2002:a05:6402:4010:b0:467:481f:df5e with SMTP id d16-20020a056402401000b00467481fdf5emr26401814eda.19.1672338254851; Thu, 29 Dec 2022 10:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672338254; cv=none; d=google.com; s=arc-20160816; b=uF3i1koQecPnmEOejK6VxioNhAwuu+kn2WLotnXLbdpTA5vW5MKaN63DYlnDU9lpac nr6TrMZyfPl//DdOcRolE3gC/W7Q2pyIALcs1r21gNHYLBbDBiNwrmSRxAdHXnLt4zr4 j9WBIPZeMobUnpO3sEpyK1sx/2wGx2/ZLwob5qerwJvyPPIUfekOsyAr8bBjO9N+HIfq l2AqZPoqFH18ySDhVYDRAfA+d20aOELvX5d6k5mhCAHPn3eogwe1piCIyD4EzaBxmZIh 1vhxwBxWg9BI2F5fy5l62ijFreztk/WEUrexgOxfZENgO6ciTBhdNBcc5CjePAzqA6hz Zh2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=2tDkhAChe3MjREfjdB9T69Lxh11z9O2raeEAqu+gczY=; b=drKxibVDznQHuqGo9DvkXBXi2jEN6PrpYfq6BoU7fIu1w2TzqUG0r7gE7NJhcQDu0G Q8jJyW+rlsWLENx9/X8x+xyACrhOval6MhVwOhnuhCVy4JaiDBEmeQ8S6P78jYyU7Vu3 027CdG6nctm5x+Bnv2qEBTX/zFGP4Zm6TwoHV5D99QuOAZZd8oi5oKZIpFinNuqw4Me3 Qp0A+7tXIdjDmmab7SaTibTDYoHy+cIZFYHXp08p0LL35m9BNminDUW0510GQZUWQqfc OPBRD1Id4EMsYtp+kSBKene7a32HW1pjHLePtxn+m4btampnEoInbJ8xSJy3Eu7za18U gyNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ee33-20020a056402292100b004542c9947c1si12498279edb.217.2022.12.29.10.24.00; Thu, 29 Dec 2022 10:24:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233706AbiL2SJh (ORCPT + 62 others); Thu, 29 Dec 2022 13:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbiL2SJg (ORCPT ); Thu, 29 Dec 2022 13:09:36 -0500 X-Greylist: delayed 2081 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 29 Dec 2022 10:09:34 PST Received: from hetzy.fluff.org (test-v6.fluff.org [IPv6:2a01:4f8:222:2004::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ABD712A90 for ; Thu, 29 Dec 2022 10:09:34 -0800 (PST) Received: from ben by hetzy.fluff.org with local (Exim 4.89) (envelope-from ) id 1pAwnn-0008Me-Uh; Thu, 29 Dec 2022 17:34:48 +0000 Date: Thu, 29 Dec 2022 17:34:47 +0000 From: Ben Dooks To: Palmer Dabbelt Cc: ben-linux@fluff.org, linux-riscv@lists.infradead.org, Paul Walmsley , linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu Subject: Re: [PATCH] riscv: uaccess: fix type of 0 variable on error in get_user() Message-ID: <20221229173447.qhcaamchxv5jkbpo@hetzy.fluff.org> References: <20221229170545.718264-1-ben-linux@fluff.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Disclaimer: These are my views alone. X-URL: http://www.fluff.org/ User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ben@fluff.org X-SA-Exim-Scanned: No (on hetzy.fluff.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 29, 2022 at 09:31:27AM -0800, Palmer Dabbelt wrote: > On Thu, 29 Dec 2022 09:05:45 PST (-0800), ben-linux@fluff.org wrote: > > If the get_user(x, ptr) has x as a pointer, then the setting > > of (x) = 0 is going to produce the following sparse warning, > > so fix this by forcing the type of 'x' when access_ok() fails. > > > > fs/aio.c:2073:21: warning: Using plain integer as NULL pointer > > > > Signed-off-by: Ben Dooks > > --- > > arch/riscv/include/asm/uaccess.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h > > index 855450bed9f5..ec0cab9fbddd 100644 > > --- a/arch/riscv/include/asm/uaccess.h > > +++ b/arch/riscv/include/asm/uaccess.h > > @@ -165,7 +165,7 @@ do { \ > > might_fault(); \ > > access_ok(__p, sizeof(*__p)) ? \ > > __get_user((x), __p) : \ > > - ((x) = 0, -EFAULT); \ > > + ((x) = (__force __typeof__(x))0, -EFAULT); \ > > }) > > > > #define __put_user_asm(insn, x, ptr, err) \ > > Looks like arm64 has a pretty similar pattern. They've got the __force > __typeof__ already, but given the similarity it might be worth refactoring > these to share the error checking code. I looked there for an idea on how to fix. > Reviewed-by: Palmer Dabbelt > > I'll give this a bit of time like usual, unless anyone's opposed I'll put it > on fixes. I wasn't planning on sending a PR this week anyway due to the > holidays. Ok, it's a warning which would be nice to be fixed. -- Ben Dooks, ben@fluff.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.