From nobody Tue Apr 7 22:01:46 2026 Received: from imap5.colo.codethink.co.uk (imap5.colo.codethink.co.uk [78.40.148.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F36B63A4F23 for ; Wed, 11 Mar 2026 10:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.40.148.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773226327; cv=none; b=KMRBqcS5Fszy/6/m+/k9/O/2gMJCMnLqocFe25NTOcSiLMVWa7bMosMFL5K3E0niS8CPyBJtkx6C/JLStI9FuUuTRislK+7M79RZpe9j+ipuLzcXRGCFQLUSJWC52G09KkNDOHG9HjIQLKj313+2K7sZ6YUyqmcr3u2SaOwmnBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773226327; c=relaxed/simple; bh=W0oj/7NzKdKnjdG7JnK6eA7h3UZjZqycA4qEHlJNlqo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FNzkVAvJV2c8gWSQSdMHj8kd4Hge98jK3Q03XfYNsB+wk7s1k3j6HOYQT2pODmt01eOtu0UF5i4JbehVGEBue5TXirdwLzg9pUspQ+Dv0T1qcqMmdxuf6N1wv9We/781MZ22/TjUlgzGFV/urQhZiRdWCI+aVT1b7vsudHvB2mk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=codethink.co.uk; spf=pass smtp.mailfrom=codethink.com; dkim=pass (2048-bit key) header.d=codethink.co.uk header.i=@codethink.co.uk header.b=L06BnIcf; arc=none smtp.client-ip=78.40.148.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=codethink.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codethink.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codethink.co.uk header.i=@codethink.co.uk header.b="L06BnIcf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codethink.co.uk; s=imap5-20230908; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:In-Reply-To: References; bh=qKmAeN5wQLc9dRpMyHH2tpIX9ilAu06aGK0dD5wjViM=; b=L06BnIcfftzRUF kNgkqnYACtJADobJTuqw6IssL+01WdGqd91Y8zhDW4QL6uU5wBh5nvBJ8Rqj5cIDhSNEmnsOL4sL4 0LTWlFWdhk61a7O0ckdraXnubulLBcBsgSla+jx7953qJJ3OnLfNpxjBHBvOU9FRt3mPGBLlF2H1b L9tppm2c2rsi/ZrpeM66mYyKK6K1aRxJH7g5uG0xDtq0ZTxY9JIB0bxpCZXOt+u3ZYEhCj/p5tPKM XHod7nwi0PUo0BqMj3DnIlcXo289CC16sEuaaDGj9bo2fZSa5PEAtPzMH8wXmvt4uxpbLA9zt7zoH BxbCtZCgnxtm+AZicwng==; Received: from [63.135.74.212] (helo=rainbowdash) by imap5.colo.codethink.co.uk with esmtpsa (Exim 4.94.2 #2 (Debian)) id 1w0HAL-00F7fH-HD; Wed, 11 Mar 2026 10:51:49 +0000 Received: from ben by rainbowdash with local (Exim 4.99.1) (envelope-from ) id 1w0HAL-00000001sja-12ZV; Wed, 11 Mar 2026 10:51:49 +0000 From: Ben Dooks To: linux-riscv@lists.infradead.org, palmer@dabbelt.com, pjw@kernel.org Cc: linux-kernel@vger.kernel.org, alex@ghiti.fr, Ben Dooks Subject: [PATCH] riscv: uaccess: fix sparse warning about cast to restricted type Date: Wed, 11 Mar 2026 10:51:47 +0000 Message-Id: <20260311105147.448717-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.37.2.352.g3c44437643 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: srv_ts003@codethink.com Content-Type: text/plain; charset="utf-8" It seems recent changes have made sparse warning about casting to restricted types whe using __get_user() in drivers such as the drivers/pci/proc.c. Fix this with a __force to fix such warnings as: drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 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/uacc= ess.h index 11c9886c3b70..5d4ec15584cf 100644 --- a/arch/riscv/include/asm/uaccess.h +++ b/arch/riscv/include/asm/uaccess.h @@ -112,7 +112,7 @@ do { \ _ASM_EXTABLE_UACCESS_ERR(1b, %l2, %0) \ : "=3D&r" (__tmp) \ : "m" (*(ptr)) : : label); \ - (x) =3D (__typeof__(x))(unsigned long)__tmp; \ + (x) =3D (__force __typeof__(x))(unsigned long)__tmp; \ } while (0) #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */ #define __get_user_asm(insn, x, ptr, label) \ --=20 2.37.2.352.g3c44437643