From nobody Tue Sep 16 19:51:31 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDB0AC4332F for ; Thu, 29 Dec 2022 17:43:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233852AbiL2Rn2 (ORCPT ); Thu, 29 Dec 2022 12:43:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiL2Rn0 (ORCPT ); Thu, 29 Dec 2022 12:43:26 -0500 X-Greylist: delayed 2252 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 29 Dec 2022 09:43:24 PST Received: from luna (cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net [86.15.83.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A40B4CE01 for ; Thu, 29 Dec 2022 09:43:24 -0800 (PST) Received: from ben by luna with local (Exim 4.96) (envelope-from ) id 1pAwLi-0030r7-1l; Thu, 29 Dec 2022 17:05:46 +0000 From: Ben Dooks To: linux-riscv@lists.infradead.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, Ben Dooks Subject: [PATCH] riscv: uaccess: fix type of 0 variable on error in get_user() Date: Thu, 29 Dec 2022 17:05:45 +0000 Message-Id: <20221229170545.718264-1-ben-linux@fluff.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the get_user(x, ptr) has x as a pointer, then the setting of (x) =3D 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 Reviewed-by: Palmer Dabbelt --- 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/uacc= ess.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) =3D 0, -EFAULT); \ + ((x) =3D (__force __typeof__(x))0, -EFAULT); \ }) =20 #define __put_user_asm(insn, x, ptr, err) \ --=20 2.39.0