From patchwork Thu Jun 30 08:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12901427 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 3DE7BC433EF for ; Thu, 30 Jun 2022 08:43:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB1C68E0005; Thu, 30 Jun 2022 04:43:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C38196B0074; Thu, 30 Jun 2022 04:43:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3FB48E0005; Thu, 30 Jun 2022 04:43:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 957536B0073 for ; Thu, 30 Jun 2022 04:43:56 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6D1EB6141A for ; Thu, 30 Jun 2022 08:43:56 +0000 (UTC) X-FDA: 79634264472.25.5957554 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by imf01.hostedemail.com (Postfix) with ESMTP id 00BD640047 for ; Thu, 30 Jun 2022 08:43:55 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id r9so16842470ljp.9 for ; Thu, 30 Jun 2022 01:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9NBX/e81JTpI1/pVA8M0cbtF/NLH2eKHJj7vwZgKmTU=; b=J6T9QcTyEdvARfdEWb4mrpD+Sc+oRolKjm+GR1j5mRMRGaJmwuaWpmLaFefw/kzE2R Zjt/RHtooFFEo8F/4Gu41LUZT4CF/FBmGdXyFepZJgktAU8Vsm2zEcTEVOXygBQ9KXWD tGfhfOM0cPl1sHs2/JXAv6IBXk4NNb+VX6xK9+18Lqd2Z6k2wnpuYdFpDO8KsyAbLfFW kVCPL3c+XJcTaPPoOtpKCnHNnxwhDQwU8FtAF4aB1C813iKENKdlFqNpc56DB5vrFYF6 2qPkUIZ2dt/w+nwqMDEm7JI2bp2VrgRQLIhQiqJ0i4BP+TQDUZaC7aFe9Q7rYYv7PIq2 cXNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9NBX/e81JTpI1/pVA8M0cbtF/NLH2eKHJj7vwZgKmTU=; b=wLDaPHY59hOes7Hod8HFyzlO3voLhu7VA7HIeFFASno3ASrj43keXldWXmgpam1XjL ZG6PnLi+MQOcTFLV8d/4l9v/4QDueuhZX+E5N3Kd7aIYHeaPhXK7aN6RU7t/+p8UbqbW XqsxFvwNkM2LmAwnMyLjVjf6AqGS7ea4iqVVXVhD3MjYS7Z7aTMca2pkaby89uvx/+H0 9v1cpv1xJ8zsHmhJkpdAtOjYs9nDNVtrI124BODsBgbTml6CJMPJk+aFEQR1XqJc7b0l aUbvdZM3KEA8XWcDiAJWcU7BTSTkiRTIEk0MCTfNEg6UpMAH/LsJm3EMWnA49qnDrKA5 KY0A== X-Gm-Message-State: AJIora/zxPdXHam01WaRvrr1KGzqmzDvNr7klgYMRy5DTs9jSJm0NCOS M8dq0OKR4EHhrkSAXEMC3pKLMdXwkrkunA== X-Google-Smtp-Source: AGRyM1sjRnFMyRbXXXDWyO4WYu/7eTlF/SOZMlOPnziKVRQb16th/R12I9BlNZqqUvUFy/8Zmfz0nw== X-Received: by 2002:a2e:8ec2:0:b0:25b:208c:b889 with SMTP id e2-20020a2e8ec2000000b0025b208cb889mr4149996ljl.27.1656578634670; Thu, 30 Jun 2022 01:43:54 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id o23-20020a05651205d700b0047f62762100sm2973023lfo.138.2022.06.30.01.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:43:54 -0700 (PDT) From: Linus Walleij To: Andrew Morton Cc: linux-mm@kvack.org, Linus Walleij Subject: [PATCH 4/5] mm: gup: Pass a pointer to virt_to_page() Date: Thu, 30 Jun 2022 10:41:23 +0200 Message-Id: <20220630084124.691207-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630084124.691207-1-linus.walleij@linaro.org> References: <20220630084124.691207-1-linus.walleij@linaro.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656578636; a=rsa-sha256; cv=none; b=PbB7xQYGA+ThKbzfXcsVc6yLES2k77yzz63EYpKgPeOtw9fCahViNEv7273Kv9XiHo0JvM 4gswTU1DLSYN8uDLs0aXae878monAN8zCVPWM3B4gzAkBTtejeP6kvFHg2dWCGuXBtpM/E IluozltF677MEug1c89fo5iRMOAdBRI= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=J6T9QcTy; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf01.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.178 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656578636; 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:in-reply-to:references:references:dkim-signature; bh=9NBX/e81JTpI1/pVA8M0cbtF/NLH2eKHJj7vwZgKmTU=; b=nN0fTH7pqh3SsJyrh8XzFGVq02mtQ7TPIGyjq+OdoBufHFXjtYOxvlkn39aFln1M2Tdzfc F1J0jPtKMtDWp5NpBWBksGMwRAA7Qivo3EI75f4qXT6Tuc0vYWZeEcFknbQcszIqYFgb5l pnBJKqlHNJvK6ZnlNwqjm58aWVRRCgo= X-Rspamd-Queue-Id: 00BD640047 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=J6T9QcTy; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf01.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.178 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org X-Rspamd-Server: rspam02 X-Stat-Signature: bcm89puxpd97aine3ypyqx4i9jk7smib X-HE-Tag: 1656578635-948710 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: Functions that work on a pointer to virtual memory such as virt_to_pfn() and users of that function such as virt_to_page() are supposed to pass a pointer to virtual memory, ideally a (void *) or other pointer. However since many architectures implement virt_to_pfn() as a macro, this function becomes polymorphic and accepts both a (unsigned long) and a (void *). If we instead implement a proper virt_to_pfn(void *addr) function the following happens (occurred on arch/arm): mm/gup.c: In function '__get_user_pages_locked': mm/gup.c:1599:49: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] pages[i] = virt_to_page(start); Fix this with an explicit cast. Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Linus Walleij Reviewed-by: Jason Gunthorpe --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 551264407624..543c68da65f1 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1672,7 +1672,7 @@ static long __get_user_pages_locked(struct mm_struct *mm, unsigned long start, goto finish_or_fault; if (pages) { - pages[i] = virt_to_page(start); + pages[i] = virt_to_page((void *)start); if (pages[i]) get_page(pages[i]); }