Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp760250pxb; Tue, 14 Sep 2021 08:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXrzgDaMWSptB5u3TuizC2mHgEumsSebdJPGR5uZ8yrPlbbpvaOg2jZcDxF2bKSPXui1/z X-Received: by 2002:ac2:5fa3:: with SMTP id s3mr13537362lfe.605.1631632260604; Tue, 14 Sep 2021 08:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631632260; cv=none; d=google.com; s=arc-20160816; b=BINVbx90oGwzXvkqb4o5TQUfbh2N2zu9LqnINNatqq1rMGY0lTlnKr6pXeizVP++52 wFZDBQIsiY2fSqkjb+QL/BOtC7buw9GCp0NB4qgxbgmBEcJ3PT5cOzAYrU8TBt1sLkdL kIZMLNNJ4pY2CekoghNsiTGuP7qCZ5KYAUDLC0jK4lWBHONdKu0zFu843gq8jMqJPSL7 A9A+zgTOpYmnQpSxAUgLDtjAkPHhxXHj4GvnMAtzsdgTXFlW4N5zpDqtSObIVBRKyzd0 TdhfXW9k49CiBWK3aDN8uGvo7XbVDEYmPb5XWbGHi2IrC+1RVtd2pXxHxFGEkXyXeSJQ eE1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=aKrXQB6oXqYQ286BOZVssQQzlSwXaZx+bOkFOE1RV1M=; b=NcIqhqUIxBjfe1JDfojREe8084hNqS+F6nN+kyadpj7DSbOS5mikSX7ZOLu/bKPJyZ 3yXVw/2hBRmZtbLEKD/3nzD1+eR9gEeJtZGbCnvASuHZtgxu+W7ddHpsThLBZ269AlmC O2rH9L+InaY1qa26QB1RyQMbA2TztEDn1h1Rl2fWV7zNQKL27mm0l0nAfHNbm5EfzMJT LgazdS6WTzmWHFr8nbPztNlaPnA7iiL/hUp42dWtST3YRxapEH8SVO23qqeR9OCeEECJ SNq6RiTP3PNIrxzgyudrTk+DFbGbSK/nD2P0mTldX6GyiwslzMaQ7CiUYztnykyEQXdW ZUxQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s27si10478609edy.251.2021.09.14.08.10.35; Tue, 14 Sep 2021 08:11:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234200AbhINPKA (ORCPT + 99 others); Tue, 14 Sep 2021 11:10:00 -0400 Received: from foss.arm.com ([217.140.110.172]:46052 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233584AbhINPKA (ORCPT ); Tue, 14 Sep 2021 11:10:00 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D945101E; Tue, 14 Sep 2021 08:08:42 -0700 (PDT) Received: from a077416.arm.com (unknown [10.163.44.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 73B6D3F5A1; Tue, 14 Sep 2021 08:08:40 -0700 (PDT) From: Amit Daniel Kachhap To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Vincenzo Frascino , Amit Daniel Kachhap , Andrew Morton Subject: [PATCH] mm/memory: Avoid unnecessary kernel/user pointer conversion Date: Tue, 14 Sep 2021 20:38:20 +0530 Message-Id: <20210914150820.19326-1-amit.kachhap@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Annotating a pointer from __user to kernel and then back again might confuse sparse. In copy_huge_page_from_user() it can be avoided by removing the intermediate variable since it is never used. Cc: Andrew Morton Signed-off-by: Amit Daniel Kachhap --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 25fc46e87214..90970d19b7dd 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5411,7 +5411,6 @@ long copy_huge_page_from_user(struct page *dst_page, unsigned int pages_per_huge_page, bool allow_pagefault) { - void *src = (void *)usr_src; void *page_kaddr; unsigned long i, rc = 0; unsigned long ret_val = pages_per_huge_page * PAGE_SIZE; @@ -5424,8 +5423,7 @@ long copy_huge_page_from_user(struct page *dst_page, else page_kaddr = kmap_atomic(subpage); rc = copy_from_user(page_kaddr, - (const void __user *)(src + i * PAGE_SIZE), - PAGE_SIZE); + usr_src + i * PAGE_SIZE, PAGE_SIZE); if (allow_pagefault) kunmap(subpage); else -- 2.17.1