Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3270989pxa; Sat, 8 Aug 2020 16:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+qF42Dish7VrexaQs3OYIw2aqFHB/iCPyqW+2ytsWlpgd0DC1PRR5MeKf9AMgL1sFt+kM X-Received: by 2002:a17:907:41dc:: with SMTP id og20mr16099585ejb.183.1596928085208; Sat, 08 Aug 2020 16:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596928085; cv=none; d=google.com; s=arc-20160816; b=OlQJsrmYJFMrd6YjUGkrr8oW9cV3BrtIsU4brAIPxZjBHuzmPjmphWqQ1Zsh7d+R7M 8Ry3pU106YkDaDk4XQo8jwj5AswmZOdSzxCktroYqDgpV87Ynz2kSh6iVQ+chcf3QUSo vxxpLQCFUbRW8uV2YiI/Mvy4pNigir4LWsXLnOQJVzJJK2U1OJMVYlBqQ+maDD34y4D/ +SXo0ja+h4ztdxjYGI4X1cqG7LxwLKFaiwgdsiC/abUvfvft4lST8CDBTxVvnvZGeuit 4uopY36/YPvzTiAeQ5dC4W4wFTzhr9HBWOssv4PJHntBDDdwDd2sZvVP3RvZYQXXsoki m2vg== 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=Yp0yxUA9Qr5sfN9dJnZ4FZ8o2dyuV6wPYjNmelJkcMo=; b=YNcYnf6CWXWNBbZxSipBFY3dgcegmjNvhmcc80E1ZvH1XJmfxgrK6OFg01sz97JRTB yOdflZMB+MATKgcYchDJN7ccRv0cy0EQ6AJlOKg1byWg+ZCHu7v94bmciTL8MXkxxvnK kWaJGUMNvbCF93Gqww8ngUM0CDl9YB1s3mrT3sukjqHUSN1D5VlkRRy2hjDAWWs5Bvyc ycKluT6GzKbhbOw4DLYT/5ph95sjxhTOd5Vgiaiaf9CdpoSdqyXSo+8sjXkXNu1nrMuC r05jriZ9+kfajpyFbbRRagPKOZx1RNn7P5Ssd3Rlkzrqlp84pCOL/uXw+xYqxt4b//VQ BZsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iF9WF3wG; 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 e16si4530196ejl.531.2020.08.08.16.07.43; Sat, 08 Aug 2020 16:08:05 -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=iF9WF3wG; 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 S1726361AbgHHXHH (ORCPT + 99 others); Sat, 8 Aug 2020 19:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbgHHXHG (ORCPT ); Sat, 8 Aug 2020 19:07:06 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346A1C061756 for ; Sat, 8 Aug 2020 16:07:06 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id a79so3090391pfa.8 for ; Sat, 08 Aug 2020 16:07:06 -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=Yp0yxUA9Qr5sfN9dJnZ4FZ8o2dyuV6wPYjNmelJkcMo=; b=iF9WF3wGU+2/gWAr8dnN9renOmkqTc4zq3LZ5XLVP10CXyaGqO/KxePCis+hRy4hc+ fz/SbbuRUrKdrxTG/KIuv4IiwcEuwwUxWpkWFLY2IpSfErWITs5aJuGs2QbIa46I6yRg qGb9r+f7JoxU55BRk/Mw/GcdQ2Nmp3kaNTv0A/iFIqKlgoyLNqmN0aftAJEaRWrPkwBr IoXOxzSkwQgFfK8RfpVKDw+2pBP0h/pN8+KUjJOKQ9HopXhVwvdx+prkBGYBkX+WMImY CISWu6uFdL8ZsMPh7Idj4tnSe168WI03aw3wSeYfqim0rjeObINfpGYuCrEd6su+s+ay bH/A== 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=Yp0yxUA9Qr5sfN9dJnZ4FZ8o2dyuV6wPYjNmelJkcMo=; b=LVv2MQWqLAolUk89L2jeIApFAZltTEa5N3hxXLkiQwAepufW2bo0MewN9OClqfhHJB F0W8iNhGFIiLwkeJboXgD/QZ9sP/M3TZVeLSpTVs3Ig9VIrW5hUwRsG7WUWRiVt0OT9c t/+rCTmdvg+y2XMKZ2yuvfhvWIr5d2dhxxyxWbnJJhJXcNgX3ZCRqN230h4XnU8CHU/h UJOXGAiSibYSU+fJjcLpWUAkWrw5DzpazMjzcMgPrLBPSbl24S37KpWpszWto2e96Mxc UTJjg5WLOQHtT/qreCvYpw6jKiAvoFJszJJg2oAG+3tCbN/joe2/JYnXWQyLoCdjx+EK fV5Q== X-Gm-Message-State: AOAM532QebBd1Cp04C0eVoc4Q6/hJzJ13XeivfzL0T9opratMsBuD9OB YhRCOlrBUF+fCfS3jvDxLOdW8z1E X-Received: by 2002:aa7:9219:: with SMTP id 25mr19490136pfo.4.1596928024575; Sat, 08 Aug 2020 16:07:04 -0700 (PDT) Received: from localhost (g223.115-65-55.ppp.wakwak.ne.jp. [115.65.55.223]) by smtp.gmail.com with ESMTPSA id m62sm16305354pje.18.2020.08.08.16.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2020 16:07:03 -0700 (PDT) From: Stafford Horne To: LKML Cc: Luc Van Oostenryck , Stafford Horne , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: [PATCH v3 2/6] openrisc: uaccess: Fix sparse address space warnings Date: Sun, 9 Aug 2020 08:06:43 +0900 Message-Id: <20200808230647.833047-3-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200808230647.833047-1-shorne@gmail.com> References: <20200808230647.833047-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 Reviewed-by: Luc Van Oostenryck --- 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