Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp837481pxa; Wed, 5 Aug 2020 14:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzGbswCD1DS7kGkF/JnCuhhNO3nOjPj/S59iWbksnqjEDb2A63aqD9I8MvX9HhxtDluj8Y X-Received: by 2002:a17:906:3b4e:: with SMTP id h14mr1269288ejf.546.1596661707278; Wed, 05 Aug 2020 14:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596661707; cv=none; d=google.com; s=arc-20160816; b=WSSkaJFSUj72cZCoykunYtSPTZtgGFfl6EqXQg7yZZVDscS1aYoT7tvu/Y86FRInKi dy59h6wglim+b3OUnI5Q4iKzaN+EtCpqmJtbEA+IYB36nMlzVz2ikSPGDXbPXslCHUKZ wcG7+39kXuqjR26r8dHwqVfJrUAKuCF+BcU3udwJaVAkWRG+HSarM8134TIhSULMM4wM /plzFzIrWl+czRnP3vjIoKdwOSbmfDTbg8j2NAg6KRx8Hm2WOtvB5owtxBgc2huZWn3f nCUzOdkA2rSb+2JXhuaCI5T/3R6S6zX92+Kw1HEDruUXK/4sSUo9TdguwPXvXOp+BuJ4 0/vg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JngFG1EkTLo4BpqZhiJxszD1gfeCHHSLXHsexflvscw=; b=gP3Bh+gDRmopBlKxKo9rdOXq2Gvg5wmAHgtMBWzzuKwQ+1uiNU5lUfuLx0nuTs3VlA jXIyT9C7l0L1tafukAKZVRTlsyjL4jnCayQt+XbXmnjkQYcTkBt1d1c1VCUItdzuO1Jz 5HE+IbnkKcIqDo+1rDJi4qAchSb2HA07I1TRZqQr5MorT6vvgmiPfg1eajN5c9TSE6AK xFYKm4UVAUnkV8CvdaYmyeHwdLoroR23cpGcqdLU+zK74zGjWUfkf10RN9BG1RcVCA8O sRwmnzxdxsMR6AWG3V7ASuHAPUg1jug1qywd2a7Bg1ccuC6S+4tKF3yM6eislXQhy1W0 LzMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vRb0olEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si1903879edq.250.2020.08.05.14.08.04; Wed, 05 Aug 2020 14:08:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vRb0olEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726490AbgHEVHt (ORCPT + 99 others); Wed, 5 Aug 2020 17:07:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725139AbgHEVHr (ORCPT ); Wed, 5 Aug 2020 17:07:47 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF608C061575 for ; Wed, 5 Aug 2020 14:07:47 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 17so3257990pfw.9 for ; Wed, 05 Aug 2020 14:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JngFG1EkTLo4BpqZhiJxszD1gfeCHHSLXHsexflvscw=; b=vRb0olEwiG/Js2ATUV13Bc/LTdwpm5CDHz0zYOPPXDLQ7Nd+qHyAa2GNpcnvVFvCwh zUn6tWgcq7MtGMGxTBijDbj7cOnmaXfMLjJv5w9aOPiWUMZJ04uVmAt/29a5NeREZ6aT 5CcQZH7GaRdkWqAZrHcIwWvOj1IlAOY6o7z8ogXdRR1Cyfd3MemzUNbQwAeC2iOHWiD4 xEbuKeb1NNf81yh7lA5Hfx1ahP1mrXodr5M2cRLSxalt2PT7dpib/hjSQg49a1ld0WK1 UeX+PeRcNGT9xJlRZj60iowG5bllUdEaBg4fb9Lx5YY/r9tsBfnp96pISz/h1LNbo97K hG2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JngFG1EkTLo4BpqZhiJxszD1gfeCHHSLXHsexflvscw=; b=V/S9de5uOPWp1PWUdwc6QDbuKTALPKUrIR521/SBdR5aU+UtBiO5E/z9BJvh8KSjvR QMV9rBvspqgCJbTk4QrB8WNNPCIyyo90xmHPNK8UY6L8ZDKKXKrMHMy8LYEPwXmYfixO FopH79lmTNDGa16aT0+FTtXRtnzjmIBJTENnHtfHBObRGVTdWBW900VxOsi3i0uSlo5U FIb3sfTaikkGeW2DcuAAtGNimtcfc6MpAqsk5GqrxDXfsLCRmDb5R2yBql1ao5YPKNcS QOW6iPxCEAo9wYHY2U/R5n3029MHYLvOx71pYV82c42eW+HKWgmC7hMiLsZ59UH1dmZX ukfw== X-Gm-Message-State: AOAM532JCRkAA06T1/9ZMF5mf2G1ppl+k/NqGJiE/pO8tpv6oHdrtQKw T37/XeuYkpYz6O4F9t2GdH7Aj2ZR X-Received: by 2002:a65:4c4e:: with SMTP id l14mr3570458pgr.200.1596661666883; Wed, 05 Aug 2020 14:07:46 -0700 (PDT) Received: from localhost (g223.115-65-55.ppp.wakwak.ne.jp. [115.65.55.223]) by smtp.gmail.com with ESMTPSA id x18sm4382508pfc.93.2020.08.05.14.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 14:07:46 -0700 (PDT) From: Stafford Horne To: LKML Cc: Stafford Horne , Jonas Bonn , Stefan Kristiansson , Luc Van Oostenryck , openrisc@lists.librecores.org Subject: [PATCH v2 2/6] openrisc: uaccess: Fix sparse address space warnings Date: Thu, 6 Aug 2020 06:07:21 +0900 Message-Id: <20200805210725.310301-3-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805210725.310301-1-shorne@gmail.com> References: <20200805210725.310301-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OpenRISC user access functions put_user(), get_user() and clear_user() were missing proper sparse annotations. This generated warnings like the below. This patch adds the annotations to fix the warnings. Example warnings: net/ipv4/ip_sockglue.c:759:29: warning: incorrect type in argument 1 (different address spaces) net/ipv4/ip_sockglue.c:759:29: expected void const volatile [noderef] __user * net/ipv4/ip_sockglue.c:759:29: got int const *__gu_addr net/ipv4/ip_sockglue.c:764:29: warning: incorrect type in initializer (different address spaces) net/ipv4/ip_sockglue.c:764:29: expected unsigned char const *__gu_addr net/ipv4/ip_sockglue.c:764:29: got unsigned char [noderef] __user * Signed-off-by: Stafford Horne --- arch/openrisc/include/asm/uaccess.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index 46e31bb4a9ad..f2fc5c4b88c3 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h @@ -100,7 +100,7 @@ extern long __put_user_bad(void); #define __put_user_check(x, ptr, size) \ ({ \ long __pu_err = -EFAULT; \ - __typeof__(*(ptr)) *__pu_addr = (ptr); \ + __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ if (access_ok(__pu_addr, size)) \ __put_user_size((x), __pu_addr, (size), __pu_err); \ __pu_err; \ @@ -173,7 +173,7 @@ struct __large_struct { #define __get_user_check(x, ptr, size) \ ({ \ long __gu_err = -EFAULT, __gu_val = 0; \ - const __typeof__(*(ptr)) * __gu_addr = (ptr); \ + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ if (access_ok(__gu_addr, size)) \ __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ (x) = (__force __typeof__(*(ptr)))__gu_val; \ @@ -248,10 +248,10 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long size) #define INLINE_COPY_FROM_USER #define INLINE_COPY_TO_USER -extern unsigned long __clear_user(void *addr, unsigned long size); +extern unsigned long __clear_user(void __user *addr, unsigned long size); static inline __must_check unsigned long -clear_user(void *addr, unsigned long size) +clear_user(void __user *addr, unsigned long size) { if (likely(access_ok(addr, size))) size = __clear_user(addr, size); -- 2.26.2