Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6282703rwl; Thu, 29 Dec 2022 10:06:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtBvxiSVn1QViranfcWiZd808883A2Wq5wVs1tXQhmEf9/qY8OQKGFgYoodMehVMhUF6jTZ X-Received: by 2002:a17:90a:2fc7:b0:219:a292:f6d1 with SMTP id n7-20020a17090a2fc700b00219a292f6d1mr32296592pjm.33.1672337199233; Thu, 29 Dec 2022 10:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672337199; cv=none; d=google.com; s=arc-20160816; b=Y0S2c+/udXaZYF4ydT7VUus6KMXvHX0YVyS/sSxkRcwXzWEGPwGDmcCHnQLddTbvEu wFndpSlAj15Kxdb52vqR9/+9TXvXd97PKYlvl87kMiV76CqP5mt37VdDZ1xIN604JBJU jlPLoYueSUbsuw26zX8VI0Pyzk7oEMR8EsMSvOS8cCkxKZZsYTK37MQbOXnA74D2ok6S VrL7o+eqDX+41pP+78IH9HjgHFTZusMZe8GQyiFZJ9Nw1qZn6Ea/wK7usKe9U4Z3wb42 BspaRYdI4M1ovO7MIB0Urb03PdrIM9MDQRDOfHAxM7mflueuZfFU980o3sETrM8bWwSv /coQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Fbd6n65HlfJ6d8ah1Bgh9m0aBc/0mUSAXZe7FzVzu9E=; b=Z/+9IN9F7YjuhAKrvg/nVxx+B+WJvcsU9g2/BI4v02qeKknP4/ofUujL9/jrFIqEwG BrBxrkTnqu0N1rInMywIG6Lh52jiObm8zkPvEx3p0AsH3OwSV9pIh4Cixqwmu2i+ZLCI knJ6lLbKkrSdbAKFqm4MCdqtUPvvxJb1vJoTUeZsDAaWaFv8moSP0hCneMb8sZQVZTzh YFefVhFDF4ZzZUst5GBZZV7gEZ5xV35aX2tOX0Dad/ZQVUZwDeAKkXXHMe1lv0KCzYsW xanVOmAcZWha+DgXd80gQnDx8Cu3wAUT7naDX4Q2P8B89tnW2mdXdnBTSJ1tk35uU+mm EO4w== 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 j2-20020a17090ae60200b00212e2e1b626si19205372pjy.164.2022.12.29.10.06.27; Thu, 29 Dec 2022 10:06:39 -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 S233773AbiL2Rn2 (ORCPT + 61 others); 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: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FSL_HELO_NON_FQDN_1, HELO_NO_DOMAIN,KHOP_HELO_FCRDNS,PDS_RDNS_DYNAMIC_FP,RCVD_IN_SORBS_DUL, RDNS_DYNAMIC,SPF_NONE autolearn=no 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 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) \ -- 2.39.0