From nobody Mon Sep 29 20:16:03 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98C29C25B0D for ; Mon, 15 Aug 2022 23:02:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347770AbiHOXC5 (ORCPT ); Mon, 15 Aug 2022 19:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352288AbiHOW73 (ORCPT ); Mon, 15 Aug 2022 18:59:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A0A27647F; Mon, 15 Aug 2022 12:57:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 825B46068D; Mon, 15 Aug 2022 19:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8634DC433B5; Mon, 15 Aug 2022 19:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593443; bh=vy+XyJyxYwqtiCG9GXqA01ZwcmWqeKZo0Fjae8q2p/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8S1W5lCyo2+5pMoVUNP1bpNDeXGBmzsBpnSN6LOOc8uxbl36rCqcw/VHMbFScGBt Hpgz3ZNU4tARa2nuBlZBo89Ggl/saI2hrGd6c2/wv9SoIIKjAMwiJ+ND8xiEq0VmqF MZDX1KapHsAOu9Jl60de0/kIsQhUmOUjGPiewMw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Uladzislau Rezki , Linus Torvalds , Joe Perches , "Jason A. Donenfeld" , Kees Cook , Sasha Levin Subject: [PATCH 5.19 0246/1157] usercopy: use unsigned long instead of uintptr_t Date: Mon, 15 Aug 2022 19:53:22 +0200 Message-Id: <20220815180449.423777119@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 170b2c350cfcb6f74074e44dd9f916787546db0d ] A recent commit factored out a series of annoying (unsigned long) casts into a single variable declaration, but made the pointer type a `uintptr_t` rather than the usual `unsigned long`. This patch changes it to be the integer type more typically used by the kernel to represent addresses. Fixes: 35fb9ae4aa2e ("usercopy: Cast pointer to an integer once") Cc: Matthew Wilcox Cc: Uladzislau Rezki Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Joe Perches Signed-off-by: Jason A. Donenfeld Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220616143617.449094-1-Jason@zx2c4.com Signed-off-by: Sasha Levin --- mm/usercopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/usercopy.c b/mm/usercopy.c index 4e1da708699b..c1ee15a98633 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -161,7 +161,7 @@ static inline void check_bogus_address(const unsigned l= ong ptr, unsigned long n, static inline void check_heap_object(const void *ptr, unsigned long n, bool to_user) { - uintptr_t addr =3D (uintptr_t)ptr; + unsigned long addr =3D (unsigned long)ptr; unsigned long offset; struct folio *folio; =20 --=20 2.35.1