Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3272385pxa; Sat, 8 Aug 2020 16:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3NfCWmskAY+sKxA6tCEC6lWR6KOR+djFIhz+3jZiVDQIK9O7FzmNE2IAYmFee48vPcw0q X-Received: by 2002:a17:907:7090:: with SMTP id yj16mr15248265ejb.73.1596928290015; Sat, 08 Aug 2020 16:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596928290; cv=none; d=google.com; s=arc-20160816; b=mrDliVm5Ts8DWXnuTA8+X53Aq/ni+oeMHWCkTs7kHNgoncZlvN3h7U4Vn+9WR7Q8BF zDcvQ/3tDSYShIkQ++aPhFGqs67DbYsHseyWeyM5yI8+ZVD4YmU6Hslu112DWvhmIB+v WhPiOTfb8QyS5EOsNkdACHgNRj6aq8OM5QPMaQdGmUIsbCfHrDs5qMHG7siiR5bXI8B9 CihMz9xPQ1BDSQZAhH4bP+ND/zDlODV4KouKoFRY+AlNyq8SejpTUcotz1u2YyJC7fAf TFqF3HBG2FMiKfhcW+ZB98bpzHMxAH+zvAynMFvun8oiUqMGf49oX9aJzja2VwoJg9W6 9vEw== 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=NUClg0Ab3PAbyali4oeRGxLd2RFA9V86+bFEaSSoP8M=; b=DM21hX0y1XQpk+fxzY0+RzckKEOoXMhxhQZ2aeWDDdKuDw7PN4+tRiVhXoowSNIHeE R45+SAELYUOGa5k0N7QdK554aw0RnV4mKhTNGcTMiGMlrJUSLyqNnMg1Se2KzDKW/6LW Qp8u7mcmYX12kWyiQrN+MVS37nOTGd6ntBXV1zcKOdmdb5dX+U8ndhQ99eribtLUXHB9 e86KM1WiDcZYxi9by7YUja5KMj8uQTBQfLDnAawJ/8IZQ8L7k/JY/eM+RkyPWAeKMw3x mzzXkvOt7ZjkguSZjph0Jsuf1HgFAi9VkfBWYXGwGuxQmGH7ggV/hGgSUQMbHQoiwkP8 /fiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CuCbFSda; 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 e15si7830641edy.357.2020.08.08.16.11.06; Sat, 08 Aug 2020 16:11:29 -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=CuCbFSda; 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 S1726232AbgHHXHT (ORCPT + 99 others); Sat, 8 Aug 2020 19:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbgHHXHQ (ORCPT ); Sat, 8 Aug 2020 19:07:16 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD86EC061756 for ; Sat, 8 Aug 2020 16:07:16 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id g19so2932563plq.0 for ; Sat, 08 Aug 2020 16:07: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=NUClg0Ab3PAbyali4oeRGxLd2RFA9V86+bFEaSSoP8M=; b=CuCbFSda2k00D2H+3Z+R8PT84kfgbVCLlRX1YnJ8p771P5IYTMsidR/avBaiql1QGd fVXYzw75ID2BHZJ5dxgMMzbKoorKBFGTp9Hijy8WtknZz23Lu6GdbGzWfki5P8PNYcMc BWfQNsGJ/qeJjGR0KQ1Qrke7RIh8ZeE0+16PusQk6u51G43w7jr5hnKYTaQQwcxuQnr1 edoyGd5f4xGTYicVhrsFm7wW8XYBp/LWGvKrQ3bXaUVZiBvHLZQxCV5vkyhcM64qBdEU puF3qBGMAf/jjwq42lzcz/mKKBuErPwa660BEGHgnupdLDvSdLzIwMnVpdeabmO0LauE PzAw== 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=NUClg0Ab3PAbyali4oeRGxLd2RFA9V86+bFEaSSoP8M=; b=RE3EAzmQMGbNFakYWUaiuRbTFkEjjZUqToXCXlFyGkg6BWW3e+Ni2cy3xnegbAtazx DFUHR2xNutsXAJQBEkzbErcoj42NRhKK3ld8XzN5Bi0dC4UO2DeA7RBfSGDG27A39nKG kzyI4veh5A7utFs/8Fi1OBWlRXts9NXsRXcKApbRg19B7wmV145/n4WADAXNLyJhn7nv KN0Jd7aY9H6UXK5HMOzqq71+gkp1Mg6aZ2sq2f/G5nz6wdCSwwz0/KpiJ8lr9J0GV9pi shThlo4S3y5Av8+6NA+PIU4ESd32VJQBGV8LFMmPkHxFy1U0DjT0xGFeNU+f71vcFBv/ TwFQ== X-Gm-Message-State: AOAM533lnMkAR+saN0pGFOLSygUyGyToSUP/jWaDZtd+gxrza7A2i2gW 8b1sXYKinJ8irV0IbObiejYuL73W X-Received: by 2002:a17:902:10e:: with SMTP id 14mr17486186plb.297.1596928035836; Sat, 08 Aug 2020 16:07: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 f17sm17651595pfq.67.2020.08.08.16.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2020 16:07:15 -0700 (PDT) From: Stafford Horne To: LKML Cc: Luc Van Oostenryck , Stafford Horne , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: [PATCH v3 5/6] openrisc: signal: Fix sparse address space warnings Date: Sun, 9 Aug 2020 08:06:46 +0900 Message-Id: <20200808230647.833047-6-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 __user annotations in signal.c were mostly missing. The missing annotations caused the warnings listed below. This patch fixes them up by adding the __user annotations. arch/openrisc/kernel/signal.c:71:38: warning: incorrect type in initializer (different address spaces) arch/openrisc/kernel/signal.c:71:38: expected struct rt_sigframe *frame arch/openrisc/kernel/signal.c:71:38: got struct rt_sigframe [noderef] __user * arch/openrisc/kernel/signal.c:82:14: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:82:14: expected void const volatile [noderef] __user * arch/openrisc/kernel/signal.c:82:14: got struct rt_sigframe *frame arch/openrisc/kernel/signal.c:84:37: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:84:37: expected void const [noderef] __user *from arch/openrisc/kernel/signal.c:84:37: got struct sigset_t * arch/openrisc/kernel/signal.c:89:39: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:89:39: expected struct sigcontext [noderef] __user *sc arch/openrisc/kernel/signal.c:89:39: got struct sigcontext * arch/openrisc/kernel/signal.c:92:31: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:92:31: expected struct sigaltstack const [noderef] [usertype] __user * arch/openrisc/kernel/signal.c:92:31: got struct sigaltstack * arch/openrisc/kernel/signal.c:158:15: warning: incorrect type in assignment (different address spaces) arch/openrisc/kernel/signal.c:158:15: expected struct rt_sigframe *frame arch/openrisc/kernel/signal.c:158:15: got void [noderef] __user * arch/openrisc/kernel/signal.c:160:14: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:160:14: expected void const volatile [noderef] __user * arch/openrisc/kernel/signal.c:160:14: got struct rt_sigframe *frame arch/openrisc/kernel/signal.c:165:46: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:165:46: expected struct siginfo [noderef] [usertype] __user *to arch/openrisc/kernel/signal.c:165:46: got struct siginfo * arch/openrisc/kernel/signal.c:170:33: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:170:33: expected struct sigaltstack [noderef] [usertype] __user * arch/openrisc/kernel/signal.c:170:33: got struct sigaltstack * arch/openrisc/kernel/signal.c:171:40: warning: incorrect type in argument 2 (different address spaces) arch/openrisc/kernel/signal.c:171:40: expected struct sigcontext [noderef] __user *sc arch/openrisc/kernel/signal.c:171:40: got struct sigcontext * arch/openrisc/kernel/signal.c:173:32: warning: incorrect type in argument 1 (different address spaces) arch/openrisc/kernel/signal.c:173:32: expected void [noderef] __user *to arch/openrisc/kernel/signal.c:173:32: got struct sigset_t * Signed-off-by: Stafford Horne Reviewed-by: Luc Van Oostenryck --- Changes since v2: - Remove __force in cast suggested by Luc Van Oostenryck arch/openrisc/kernel/signal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 4f0754874d78..97804f21a40c 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c @@ -68,7 +68,7 @@ static int restore_sigcontext(struct pt_regs *regs, asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs) { - struct rt_sigframe *frame = (struct rt_sigframe __user *)regs->sp; + struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->sp; sigset_t set; /* @@ -76,7 +76,7 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs) * then frame should be dword aligned here. If it's * not, then the user is trying to mess with us. */ - if (((long)frame) & 3) + if (((unsigned long)frame) & 3) goto badframe; if (!access_ok(frame, sizeof(*frame))) @@ -151,7 +151,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig, static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) { - struct rt_sigframe *frame; + struct rt_sigframe __user *frame; unsigned long return_ip; int err = 0; @@ -181,10 +181,10 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, l.ori r11,r0,__NR_sigreturn l.sys 1 */ - err |= __put_user(0xa960, (short *)(frame->retcode + 0)); - err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode + 2)); - err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4)); - err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8)); + err |= __put_user(0xa960, (short __user *)(frame->retcode + 0)); + err |= __put_user(__NR_rt_sigreturn, (short __user *)(frame->retcode + 2)); + err |= __put_user(0x20000001, (unsigned long __user *)(frame->retcode + 4)); + err |= __put_user(0x15000000, (unsigned long __user *)(frame->retcode + 8)); if (err) return -EFAULT; -- 2.26.2