From patchwork Thu Sep 2 21:56:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12473079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82434C433EF for ; Thu, 2 Sep 2021 21:56:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B259603E9 for ; Thu, 2 Sep 2021 21:56:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3B259603E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DA6E46B0121; Thu, 2 Sep 2021 17:56:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D57106B0122; Thu, 2 Sep 2021 17:56:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C239A6B0123; Thu, 2 Sep 2021 17:56:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id B36606B0121 for ; Thu, 2 Sep 2021 17:56:45 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 77CE81844E3AD for ; Thu, 2 Sep 2021 21:56:45 +0000 (UTC) X-FDA: 78543993570.14.1639DC0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf16.hostedemail.com (Postfix) with ESMTP id 3750CF000090 for ; Thu, 2 Sep 2021 21:56:45 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 36EEC60FA0; Thu, 2 Sep 2021 21:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1630619804; bh=c5yA802kgCeNP/tLSxN9yttaY1VJIrX9mOtaDPcnYuI=; h=Date:From:To:Subject:In-Reply-To:From; b=sFaFLMJXkdHA5fm6uetk4dgigGOSRxF5qHj968JUlEvd4u2WLJWqK/smEPMUDN1tk 6cujCyUx7GQG1eMebEaJA639Vcd2BPxfDACoeDp9lDBpMHhBdwlom3eRyz+ttGdpJf z0QcS1D2GCAz+mUn3thSAH8IADV36vonGqAaB3sw= Date: Thu, 02 Sep 2021 14:56:43 -0700 From: Andrew Morton To: akpm@linux-foundation.org, dhowells@redhat.com, djwong@kernel.org, gregkh@linuxfoundation.org, hughd@google.com, jordy@pwning.systems, linux-mm@kvack.org, mchehab+huawei@kernel.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, william.kucharski@oracle.com, willy@infradead.org Subject: [patch 126/212] mm: change fault_in_pages_* to have an unsigned size parameter Message-ID: <20210902215643.s0dGtsXtL%akpm@linux-foundation.org> In-Reply-To: <20210902144820.78957dff93d7bea620d55a89@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=sFaFLMJX; spf=pass (imf16.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: 4qb67xjezra75nmi8cshee8gh6rte4km X-Rspamd-Queue-Id: 3750CF000090 X-Rspamd-Server: rspam04 X-HE-Tag: 1630619805-272196 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: From: Greg Kroah-Hartman Subject: mm: change fault_in_pages_* to have an unsigned size parameter fault_in_pages_writeable() and fault_in_pages_readable() treat the size parameter as unsigned, doing pointer math with the value, so make this explicit and set it to be a size_t type which all callers currently treat it as anyway. This solves the issue where static checkers get nervous seeing pointer arithmetic happening with a signed value. Link: https://lkml.kernel.org/r/20210727111136.457638-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Reported-by: Jordy Zomer Cc: Matthew Wilcox Cc: David Howells Cc: William Kucharski Cc: "Darrick J. Wong" Cc: Hugh Dickins Cc: Mauro Carvalho Chehab Signed-off-by: Andrew Morton --- include/linux/pagemap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/pagemap.h~mm-change-fault_in_pages_-to-have-an-unsigned-size-parameter +++ a/include/linux/pagemap.h @@ -736,7 +736,7 @@ extern void add_page_wait_queue(struct p /* * Fault everything in given userspace address range in. */ -static inline int fault_in_pages_writeable(char __user *uaddr, int size) +static inline int fault_in_pages_writeable(char __user *uaddr, size_t size) { char __user *end = uaddr + size - 1; @@ -763,7 +763,7 @@ static inline int fault_in_pages_writeab return 0; } -static inline int fault_in_pages_readable(const char __user *uaddr, int size) +static inline int fault_in_pages_readable(const char __user *uaddr, size_t size) { volatile char c; const char __user *end = uaddr + size - 1;