From patchwork Thu Jun 16 14:36:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 12884080 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2E73CCA499 for ; Thu, 16 Jun 2022 14:36:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C3656B0071; Thu, 16 Jun 2022 10:36:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 072DA6B0072; Thu, 16 Jun 2022 10:36:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E551B6B0074; Thu, 16 Jun 2022 10:36:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D358C6B0071 for ; Thu, 16 Jun 2022 10:36:31 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9D50B64C for ; Thu, 16 Jun 2022 14:36:31 +0000 (UTC) X-FDA: 79584349782.05.806633B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 184FE140041 for ; Thu, 16 Jun 2022 14:36:30 +0000 (UTC) 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 0D12261DEB; Thu, 16 Jun 2022 14:36:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE632C385A2; Thu, 16 Jun 2022 14:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1655390186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=HPAtaIeUzFGETtepNlx7oLoJv5QwPzhpAP3HikjfJM0=; b=DaikPer8ueIhZk7aIyzyf4bBdHkIGHkDbS3F2CMbp3CIOT/Y0wncEunWvGF9PHmAdP33A8 Wqe2Q441lhxPeQfjd1rTGZn//lhaslF6PN3tH+PDw6TpGE3JsxljsAK46KV7qWlp1/RDt9 T+4KQ1Y8Uu/3HsYuXYgY6xnjS8IfrMw= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 8198e951 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 16 Jun 2022 14:36:26 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" , Matthew Wilcox , Uladzislau Rezki , Kees Cook , Greg Kroah-Hartman , Linus Torvalds , Joe Perches Subject: [PATCH] usercopy: use unsigned long instead of uintptr_t Date: Thu, 16 Jun 2022 16:36:17 +0200 Message-Id: <20220616143617.449094-1-Jason@zx2c4.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655390191; a=rsa-sha256; cv=none; b=WtmujrjzWk05FRqmWo3hE/uM7mQ4M1e+c+IBPu+SCHu4ViZSUlc1o8HEd9UXUwyBrTux/T ijNlB9jg0T295x2cVMf5Yl10Eg5k7QOPtgrGIxjzf34KyL2wSQErVWNwAI+BkC7h9fF3qW nSxoo+wUQHR98bAe1qIwP2TGXEMIFIk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=DaikPer8; dmarc=pass (policy=none) header.from=zx2c4.com; spf=pass (imf09.hostedemail.com: domain of "SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655390191; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=HPAtaIeUzFGETtepNlx7oLoJv5QwPzhpAP3HikjfJM0=; b=F+sG4qkCEsCWjbATlHOiyC56/S+AeeJS7DKUW2fu/2z0J9JcIsF0NFc958b6QZhRuyH9NR 9EtZDzJmHgXNK5js+KGxESniHLUo1GdEvlE8jx0vfTPJP6Cx1Nk+56RyTOjxZtsBtXsPT6 Q/K9JDitn3fHyDa3T+uVccqOFhKhrLc= X-Rspamd-Queue-Id: 184FE140041 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=DaikPer8; dmarc=pass (policy=none) header.from=zx2c4.com; spf=pass (imf09.hostedemail.com: domain of "SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=YYNU=WX=zx2c4.com=Jason@kernel.org" X-Rspamd-Server: rspam06 X-Stat-Signature: nhj95xh1bbxa6tmksu4cpu1b9ea3fzt8 X-HE-Tag: 1655390190-3054 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: Kees Cook Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Joe Perches Signed-off-by: Jason A. Donenfeld --- 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 long ptr, unsigned long n, static inline void check_heap_object(const void *ptr, unsigned long n, bool to_user) { - uintptr_t addr = (uintptr_t)ptr; + unsigned long addr = (unsigned long)ptr; unsigned long offset; struct folio *folio;