Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp23578pxa; Mon, 3 Aug 2020 21:25:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp1FUG0BeBtKqT2wnka1QjUYTQwnKh6tXgckJF/KqSnRX0yv9yEN/t31N+1yIITlND7e6c X-Received: by 2002:a05:6402:12d7:: with SMTP id k23mr18801374edx.312.1596515102848; Mon, 03 Aug 2020 21:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596515102; cv=none; d=google.com; s=arc-20160816; b=PFMIwqhDgC2/ZASO1ZAgSiK5XTV2j19+cpNH8UhItEJOKtokReaCw9pmap6qocffka wFEhlU67ORWKGqIqJ/ADL0iu7IOrwG7MYqvNF8e+clZY2XQSZsNgDBguRcVC6665y3Gu hJPr1jZqO4oSXCU7D2Jzuq0JEmAR4B/8/uCPaZr79/RXtckGkR6VEo7md2ew8d+tGrcX z3g3QqUsGt3nwcOUkwWl6FYFY+h4z0odoArNVbwSeKCW2iC27G4xGie3HnlhCi9PDRd6 N5uH5FPdtZCtSX3uMB5uPuxo5l82e9+kTQQlneQdNYIbPwKsyII6GnX3f/C2IzzXTB5m Kmzg== 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=SvBfGkOJB+p/sz1XJYjeDoXp2900mTl9Cx1mf9xCtML1BuNdX1sQuXDAKRXS3F1UvO 6wFkPK6c21jfK7VhkzFmonr6reXEhoVpcTO17S1GntskhFTJyzIuuqhIh9BpKHwjADn2 ee3bHhX7o9+L79bspZ355ES3wTuUlUaUtvSlFYwLuLN9p9/lTxvFoNZn37MHiQiDIgUo 8wVZyM9JfrIlKN40i2uMBxTDlP8xtUQZh7Dn23EKxEsFgP6PrELg9sXtASGGmIHrvKWp DrCWtnHka8oP5xYRCa1UkeXeDRLsySvdFl38buTTl2+GApateheruHIelvnpYUYjAPCM +H4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K+z3LaGk; 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 t10si9796246eji.566.2020.08.03.21.24.40; Mon, 03 Aug 2020 21:25:02 -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=K+z3LaGk; 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 S1729659AbgHDEYQ (ORCPT + 99 others); Tue, 4 Aug 2020 00:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgHDEYQ (ORCPT ); Tue, 4 Aug 2020 00:24:16 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E9FBC06174A for ; Mon, 3 Aug 2020 21:24:16 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id c10so975520pjn.1 for ; Mon, 03 Aug 2020 21:24:16 -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=K+z3LaGknG3+dskAQIYMfnPKZZK9plCBb+szon+FT/j+2OfxNClUn1QhGrHJ5Y9/mP MTv0g3GD6cpoOaHa2uT6sx9vNEqrNbrpVbjR2I4/6Vm/K04cvprsA8wQDKhcmmIkuWvg wCxeQXSiWWFwz8jn5WI6+1sqASV2cs+MiO40IB5OOlV61y324Sq6VfZs/ca1Ow/tS+vG Hwn2cd1G7ea5W3GkQyif4XReLegm74iGrxoCxVIarH8ASnQgoY5hbPijDuvKv+712y/p UMkgde2b0G56XmiZUYIXsvA9wGnG2h5go9RxdWAuu01FYYkWLOOCCROHAdplkQyuBGy+ vlkg== 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=Lml//gXi+7pfdc5SVZRj6GsIWl2DBooFGnnpwvyQzpLPNGGh2gaZn0HlWz2JyU0pgz p9m6kIZ2MIxmM4J5v+JAVOBA8fUFO3gS+4qzG3jK3IGdwAH/x2o5mDjWyzt8+rsp2I6N TB6GgHVvebPSeS2vYkP6Wafor2sp3Q3FxWpmhFDn2kA0aYM1LeRDzC1WXTwtvzydYUMq 9E1mAq9KdCkZKL6icu3VeULXC/KbUI2dSRDQIyFCWgqfy7W25qp/sLstvfAPHNq1sQaC +tbZyVoTgKqrpOxvmgSojyZOKamAnifXzkm5GsFpR96euI+AWZzDF646qMzLp4iegBjg kVtQ== X-Gm-Message-State: AOAM5303ye8uDL52FbPRaMVqS0g0V49DTpJDQg6VlZMhXDKIKel0ekwb RKRK/ZIchrefZFZmrkBdcc7CDgOL X-Received: by 2002:a17:902:7246:: with SMTP id c6mr17804962pll.17.1596515055411; Mon, 03 Aug 2020 21:24:15 -0700 (PDT) Received: from localhost (g223.115-65-55.ppp.wakwak.ne.jp. [115.65.55.223]) by smtp.gmail.com with ESMTPSA id j130sm107809pgc.76.2020.08.03.21.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 21:24:14 -0700 (PDT) From: Stafford Horne To: LKML Cc: Stafford Horne , Jonas Bonn , Stefan Kristiansson , Luc Van Oostenryck , openrisc@lists.librecores.org Subject: [PATCH 2/6] openrisc: uaccess: Fix sparse address space warnings Date: Tue, 4 Aug 2020 13:23:50 +0900 Message-Id: <20200804042354.3930694-3-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200804042354.3930694-1-shorne@gmail.com> References: <20200804042354.3930694-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