From patchwork Thu Jun 30 08:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12901424 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 AB394C433EF for ; Thu, 30 Jun 2022 08:43:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24E9F6B0072; Thu, 30 Jun 2022 04:43:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FE838E0003; Thu, 30 Jun 2022 04:43:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C6498E0002; Thu, 30 Jun 2022 04:43:51 -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 F24006B0072 for ; Thu, 30 Jun 2022 04:43:50 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D5DE06141D for ; Thu, 30 Jun 2022 08:43:50 +0000 (UTC) X-FDA: 79634264220.02.05FA609 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf29.hostedemail.com (Postfix) with ESMTP id 8707712003F for ; Thu, 30 Jun 2022 08:43:50 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id a2so32502299lfg.5 for ; Thu, 30 Jun 2022 01:43:50 -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=FRwgkTSNohRfiL5f9W62+pqiZh7C0RRMUcztPjMF0+Y=; b=XuSV5nDaJo8fSzAsBYl717/yebW1VwQTju3kxDtZZOkoFdIFYr6buKj8dY9nyzw3zY a3nIjRZAZ6ZntE3rtccSjUVMBh7zF6ppBPAnjgOHEUCao95+Z58cAjeVJ9SonXGeN/o9 0+L9gOGAu7Lyray3CWodEvcD6pkuRN3nD1Op2inrx0s3r9YrblMHhERlvIT1jL3zdv+0 KCc3i36s6ttDv+/IWog/J//2kX51uJb6furgp0LpczO+D6t7vD2BI0Olffl7PtuZH53Z vtY9UlKzrLnx010VoslviDkVRMHgYpWW8fc8kj03WZsIBj9skjF797aQBzfuzLJCOi0a 4iLQ== 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=FRwgkTSNohRfiL5f9W62+pqiZh7C0RRMUcztPjMF0+Y=; b=Ckmo6cafwGNhU8fjlc5kuIZL01SmaiAnMwNtpDKpbWHvhg653jr/ZWpUl5z5ZSRgzA tJ+laMaFjLEaR4xazQJnUzvKs2xGG7DYNtT25BUUUpgfK1ZxPC1BPZ9Ylsyh/Ttvn1vK lYVyMievgtGgVt3uyIZMyMWwXZvcADhc09sVSNONkh9cCmkEMYEbAc67vAxGow2O8KYl sJ+kLz9szFKRk6QaZrXVy5oPeEm2XauTnAzUScUGjdAlyitp5bDyfjelDQHNdjUHckVq coBW1/SJNCby0Iei6wLx+kzjSFnMT/oBSS/O6J25lKw6T3vRPD0yNwq5XNsYB7DL7Q1K csLQ== X-Gm-Message-State: AJIora/tT8U7deiCCD//l7MjmRW2XeeV775hv08JNERxRD7VXoDvp/KT QbV4UL+Vbr1cq9x59IGOYxCJNg== X-Google-Smtp-Source: AGRyM1uIwKcN0gApoCr24yelttj8AFsK9iNIfAhV3cWCBex2e3fIW5TAUkqsETKUbzrFHPRgVbjXLg== X-Received: by 2002:a05:6512:260a:b0:47f:ab30:d624 with SMTP id bt10-20020a056512260a00b0047fab30d624mr5063877lfb.326.1656578629159; Thu, 30 Jun 2022 01:43:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:43:48 -0700 (PDT) From: Linus Walleij To: Andrew Morton Cc: linux-mm@kvack.org, Linus Walleij Subject: [PATCH 1/5] lib/test_free_pages.c: Pass a pointer to virt_to_page() Date: Thu, 30 Jun 2022 10:41:20 +0200 Message-Id: <20220630084124.691207-2-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=1656578630; a=rsa-sha256; cv=none; b=BajTHisnWVyhB/Vg8LIl3xRHWM+cd+Dk0QgejbsU1dY32hMfl0HxlT5tTWBIONFm9qtNUC G6gjQEdz8MGLIymCxUQw1x7grQ0npBO/1TrDxcf13hBmmVEl+6j3QUI3iNYQZ3UkCLsqzg ltxPqizn1Mkf9ydgOGz0p3uXG4Za5xs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=XuSV5nDa; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf29.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.167.54 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=1656578630; 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=FRwgkTSNohRfiL5f9W62+pqiZh7C0RRMUcztPjMF0+Y=; b=RZ2heSgjZMiz9q77l7dUqjpGEU4lKIc0GyRAWpLRN7Nr4RjHupLGw4HMi4IbHXUchAvpjT C2Zp4ESfMLHkQRnaFYEs1QkTNEcfeH4gFRmnE+1CUsLYPWp/JIdhuAik3GdbR44DjoRVJM w2gC3A/J6jedcPdx6pZjf+N47R39Y7M= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8707712003F Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=XuSV5nDa; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf29.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.167.54 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org X-Rspam-User: X-Stat-Signature: 1qrqqupbbwhib7okswtsq4porwdk9du5 X-HE-Tag: 1656578630-452292 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 pointer into virtual memory is represented by a (void *) not an u32, so the compiler warns: lib/test_free_pages.c:20:50: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] Fix this with an explicit cast. Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Linus Walleij --- lib/test_free_pages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_free_pages.c b/lib/test_free_pages.c index 25ae1ac2624a..9ebf6f5549f3 100644 --- a/lib/test_free_pages.c +++ b/lib/test_free_pages.c @@ -17,7 +17,7 @@ static void test_free_pages(gfp_t gfp) for (i = 0; i < 1000 * 1000; i++) { unsigned long addr = __get_free_pages(gfp, 3); - struct page *page = virt_to_page(addr); + struct page *page = virt_to_page((void *)addr); /* Simulate page cache getting a speculative reference */ get_page(page); From patchwork Thu Jun 30 08:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12901425 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 B0977C433EF for ; Thu, 30 Jun 2022 08:43:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D6DF8E0002; Thu, 30 Jun 2022 04:43:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3864C6B0074; Thu, 30 Jun 2022 04:43:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24EE98E0002; Thu, 30 Jun 2022 04:43:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 14C0C6B0073 for ; Thu, 30 Jun 2022 04:43:53 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id C887161169 for ; Thu, 30 Jun 2022 08:43:52 +0000 (UTC) X-FDA: 79634264304.22.425C0B5 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by imf16.hostedemail.com (Postfix) with ESMTP id 63BD5180031 for ; Thu, 30 Jun 2022 08:43:52 +0000 (UTC) Received: by mail-lj1-f169.google.com with SMTP id s14so22187252ljs.3 for ; Thu, 30 Jun 2022 01:43:52 -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=+mWa9uy7ICYbhRKIdnH3Wgfnf22wyfGmVH7zQlKGXVg=; b=nIfKpOgf+DgKD9NQ/+rnH0Tt0Eh9mEo4JtYG/gXqPmCHs0dS9D59YzmM6MwhgZpk50 S3616TOcHJ8GIrOoKmSVhaXKQJVvh15QbLGwZGGLPZVXvDW8cmB2HmOpjvQM/cSCtayC 7fpG08B18h4nYVIvcCy9C9LLcpcJyn82RxyUxqD8GQX9lP1XxOoiVHypPOg9PUoV5h+Z ZkK75FUvTZCulRCVaLOytmh8bMFCnaygW/JhZrC7TRBAVlHGR/Un/mymJeE1mKlCFTzZ 1+Qc2I1NITgbq/T3jcwY8v5FrfX7fKmoeA0iKhTOiVRO/3RuYYJakNlhw8CCFMqjX3Y1 Ef6g== 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=+mWa9uy7ICYbhRKIdnH3Wgfnf22wyfGmVH7zQlKGXVg=; b=QkSKGLlKMHnPaClkqy5g2603MgnZI7OFfCElgwUGQNcKBGOZJ5aniKK2sEEMXnpR+n 7QKug/StVu2g+LEdimWL3Lt8md9LAbP/bRwnNW6UxkS4BFJ92C1GmnpKt7A2gFWLnoQl L9uDXj0t2RZ9E7nEDzaJMHEp+EJ5tOZ6AC1FBRtSV+HhDGpW3EHl6jaL/Sft5wK/Reof D1T/BSV0zRK7/VLrRL4ZIV3BB6DkcJvx9gyyJRvBbHkbMo1V2H3hU1ZGhCTWccB7Jgpt E6/ziBNuwqwuT/JReDweiY7w/IBAgj4O5A98Ui6g8QlaDRsjreRQkD6YaQfccFgbYaFp zJvA== X-Gm-Message-State: AJIora9UROG5t4vMSC/sUrlKxwlsZFAWUvS2BGMHkMptsEvwRS11MfNB WlbNQh4uzJjZvv8nS0d9LmodmQ== X-Google-Smtp-Source: AGRyM1ufws5XubUS21/PCnMupVOGV6Q7BRiUwxb6JwjuVYh4cMAPwJaWBkL8xcIULfRuz/L5/eU86g== X-Received: by 2002:a2e:934b:0:b0:24f:cce:5501 with SMTP id m11-20020a2e934b000000b0024f0cce5501mr4271792ljh.443.1656578630976; Thu, 30 Jun 2022 01:43:50 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:43:50 -0700 (PDT) From: Linus Walleij To: Andrew Morton Cc: linux-mm@kvack.org, Linus Walleij Subject: [PATCH 2/5] mm/highmem: Pass a pointer to virt_to_page() Date: Thu, 30 Jun 2022 10:41:21 +0200 Message-Id: <20220630084124.691207-3-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=1656578632; a=rsa-sha256; cv=none; b=EzN3a+nAAeAaXS70OLMIKfIv6V9syTQ1F99x/8fz29nXXuA0Y7JAeHJ0HSb9IROXvrGhGN VZ2d1RnADsjdDjkbBynRTBOptEdYUmzHVdgoUm/kkUUoVAOSucqF4iR4fnbrG8r4C7pD8U XnnjEvNWimY8HuIM6v+K0iMeeLhk2KU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=nIfKpOgf; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf16.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.169 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=1656578632; 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=+mWa9uy7ICYbhRKIdnH3Wgfnf22wyfGmVH7zQlKGXVg=; b=F3e/Gwmj04Cck9rSkJqx1eqV/n34+1xyjxCpF5sC4bW1aVLxDw3Tc1c/C3mXez763nLO6V yJKe9n9fJ238nIeMNhcMUvbj1Dn+XoYcMoyUlJH3VRWlKFf8jWicuL54USm3b1XQYVG79P bqACBrVO/Ug0BgYVBtUZDpnPMZ/PgYo= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 63BD5180031 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=nIfKpOgf; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf16.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.169 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org X-Rspam-User: X-Stat-Signature: sywz75n1crodny8cda9o38ajabjsinu3 X-HE-Tag: 1656578632-640679 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/highmem.c:153:29: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] We already have a proper void * pointer in the scope of this function named "vaddr" so pass that instead. Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Linus Walleij --- mm/highmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/highmem.c b/mm/highmem.c index 1a692997fac4..e92a7ceb30e8 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -150,7 +150,7 @@ struct page *__kmap_to_page(void *vaddr) return pte_page(pkmap_page_table[i]); } - return virt_to_page(addr); + return virt_to_page(vaddr); } EXPORT_SYMBOL(__kmap_to_page); From patchwork Thu Jun 30 08:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12901426 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 C6982C43334 for ; Thu, 30 Jun 2022 08:43:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6486F8E0003; Thu, 30 Jun 2022 04:43:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F61F6B0074; Thu, 30 Jun 2022 04:43:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BE498E0003; Thu, 30 Jun 2022 04:43:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3EC1D6B0073 for ; Thu, 30 Jun 2022 04:43:55 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1B88E357F9 for ; Thu, 30 Jun 2022 08:43:55 +0000 (UTC) X-FDA: 79634264430.02.FE122FA Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf23.hostedemail.com (Postfix) with ESMTP id C6F5B140042 for ; Thu, 30 Jun 2022 08:43:54 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id a11so22154889ljb.5 for ; Thu, 30 Jun 2022 01:43:54 -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=R+x4xUlXaoDhtuO4AscHrz+MJh/LM6gsUwNc9kO1v+E=; b=OSmDR7wary1m1qUfrlxL2I6Ug0MRO/qHr/34gExjesE+/q3nH9Z6LM9IpyxGURbS/e d94KEmX77fcR/Db51wz5FYadJVArANKXYKIR8/an06jAfRDQDaZuB7QeUY0gDXlWawbf HzNHH4ZHSNJoKH9iFSwcCJBBh1ZsRajJ1h4dK6KYPyOt+I59Tp3kwW11PmC5A4bWwypC 2p4PfnqcWgHbmHU705IUG3aMXH7wBmiHZCg+kqxVaoV5DS74iNEiwntKMhVj+CWdYL9p Ey+UZcYv5qV2AnVZiDvMy7zUE1hVyAHFhZdFJyPfHNjtwIhSUgeK9x5KWXVjWC30SiST kCPQ== 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=R+x4xUlXaoDhtuO4AscHrz+MJh/LM6gsUwNc9kO1v+E=; b=Pwdadiat65r+TWNartldR53+EpKMZQFG+gch73InnlvRy0FDY/4fX2Ok41Epk3cTAY HxH2G4ESh6pNv3KI6H9hxEvQ+R7xjS5lq2SftXz32skF8N5y2uwGL/fkta+rUiO2EWk5 3Gv2G3BrjnTBu3N6S9A3Uf8hGcUjqwi3vpYfPy5mkgEFAoxr7dvgFbIYL5LIP173xjaA Pw/uO1C6+b/vDCe/+h+rT57l/ZYIelzAv6BZVgMFzxZxkgyKi67L7LILMOV6K00dSTle DJ9tlH09w56yzp/VUq/vOy89lKcGy5vckKshLpsOcl1+yuQGwZNe//+HC8VoCKaDn37h VyhA== X-Gm-Message-State: AJIora+rah5bmDtW79MG/bk6P9n0RADuEnH4V204Yz8UQ1alxH7E4It6 jUJG4H5JXPzjejp5tDkdB1Iczg== X-Google-Smtp-Source: AGRyM1ux2ROim9MMsELLAdIM+hGEz9MlFxZrA74q2h10NXMDFRi+J2wQIDeULLfRxLLAl0Px/GIr9Q== X-Received: by 2002:a05:651c:231f:b0:25a:66c3:c213 with SMTP id bi31-20020a05651c231f00b0025a66c3c213mr4221114ljb.288.1656578633145; Thu, 30 Jun 2022 01:43:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:43:52 -0700 (PDT) From: Linus Walleij To: Andrew Morton Cc: linux-mm@kvack.org, Linus Walleij , Alexander Potapenko , Marco Elver , Dmitry Vyukov , kasan-dev@googlegroups.com Subject: [PATCH 3/5] mm: kfence: Pass a pointer to virt_to_page() Date: Thu, 30 Jun 2022 10:41:22 +0200 Message-Id: <20220630084124.691207-4-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=1656578634; a=rsa-sha256; cv=none; b=j9Kd7KkJIgL/69tMVUJqHjl+7czPUGwVnHwVcV2YfnVP3/dSvyZEHrBWzm5kDLY/UrW8P2 +kcPO4QKUvl9wSLWuDqHJjNR06w3Xs8oulNBD54FA1F6pM674+SGlxct24Q+1CyDMW1b4c Q332buhZ3f8fqFaCvXqrNgr4QFxtDrg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=OSmDR7wa; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf23.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.173 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=1656578634; 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=R+x4xUlXaoDhtuO4AscHrz+MJh/LM6gsUwNc9kO1v+E=; b=jPR03CY178JpGrN7mczpogs+lG8WxEnV2Tk3l9sYAfjz3YPvsSX8HZQoT+TAu8+Sj2hcEq v4nar5kPGZGbQqc45XYwY+rzS1OhzCVWFeGPVR+8h5wbcLiNz+gK0skpAHF1Wkt/H20yY/ AXIW32NOAg2lCahamRlXJEkP/2DgpDs= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C6F5B140042 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=OSmDR7wa; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf23.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.173 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org X-Rspam-User: X-Stat-Signature: 16591othjbckemmh46whjuju5w5mtcyt X-HE-Tag: 1656578634-104630 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/kfence/core.c:558:30: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] In one case we can refer to __kfence_pool directly (and that is a proper (char *) pointer) and in the other call site we use an explicit cast. Cc: Andrew Morton Cc: Alexander Potapenko Cc: Marco Elver Cc: Dmitry Vyukov Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Signed-off-by: Linus Walleij Reviewed-by: Marco Elver --- mm/kfence/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 4e7cd4c8e687..153cde62ad72 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -543,7 +543,7 @@ static unsigned long kfence_init_pool(void) if (!arch_kfence_init_pool()) return addr; - pages = virt_to_page(addr); + pages = virt_to_page(__kfence_pool); /* * Set up object pages: they must have PG_slab set, to avoid freeing @@ -657,7 +657,7 @@ static bool kfence_init_pool_late(void) /* Same as above. */ free_size = KFENCE_POOL_SIZE - (addr - (unsigned long)__kfence_pool); #ifdef CONFIG_CONTIG_ALLOC - free_contig_range(page_to_pfn(virt_to_page(addr)), free_size / PAGE_SIZE); + free_contig_range(page_to_pfn(virt_to_page((void *)addr)), free_size / PAGE_SIZE); #else free_pages_exact((void *)addr, free_size); #endif 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]); } From patchwork Thu Jun 30 08:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12901428 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 9A68CC43334 for ; Thu, 30 Jun 2022 08:43:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 339C78E0006; Thu, 30 Jun 2022 04:43:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 274DC6B0074; Thu, 30 Jun 2022 04:43:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C71B8E0006; Thu, 30 Jun 2022 04:43:58 -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 003536B0073 for ; Thu, 30 Jun 2022 04:43:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id C92D5808ED for ; Thu, 30 Jun 2022 08:43:57 +0000 (UTC) X-FDA: 79634264514.25.873D66C Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf15.hostedemail.com (Postfix) with ESMTP id 7C3D1A002F for ; Thu, 30 Jun 2022 08:43:57 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id b19so9418557ljf.6 for ; Thu, 30 Jun 2022 01:43:57 -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=8s0PQKdATgRrGcuVyDnYrmCWblAWXzSHruyiRsnHNJg=; b=BWPu/+9TwLlN06ZRVUrq7KVIkNDX7GU8SKlPMA6k46mS5J8zszxiKEPPYxg+EQkKKM bR4UPnVKQmFZ7TCGGGnU12lxagYbzjEg+CDRhYbg3Ix/CqGGSF324nKrdmvXIJqJsAdc DIr1OyGVuiYVMO2HqoOm19vRMIRz9yLDE8ofSK92MO5iJg9/nSg8zMa8VD7f+aEqB56d yjPhckPFnA2BeQlrtjPBOYg3KZNa41HH4jJTLOcz7M6B6gD24W8HNMv13fLEHAZNJnSQ Dym2t/OuD4/shKlCzIgGWvObTcA5Xghtp6E8s1+OQXx0pC7DS0MqPbnTK/1WkWhcoXNw nPRA== 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=8s0PQKdATgRrGcuVyDnYrmCWblAWXzSHruyiRsnHNJg=; b=JI3YLI+IvBfw1c8KGymk5kngbJeE9V4nHaBZEzzBqzM7z9XPtVc2DlY83qbOtWwjHz Y6QxQVnm8ehOuvF5zcfqIrRkkrg0WUrg7bgPbBzUAaaT3uE1d7uiWUFjJCdtqSI5W6HL 6lwkKIbsUVm3/h+BWl2ljCUXjJBR5fnyoeM2xpRGFYuzM36bJKIOPzRm9klf2UwN3H8a 3kgAvDPhJQ8+6R0bCROCrf9pJjh+7uDCL4grdeFAFCBMkDT8/gQbjJ/0rGeTJ6qJrDla jM8aAW4+JFpLHZZTkfwAcA7iaaBeW+DfTV0Z26kBPyQcucYBYlMbLP6xvOKBfc++nl92 C2Eg== X-Gm-Message-State: AJIora+rD1k1+kZx60SWiTVIpINA01WXOA/IS6UAIpIOnxmr577ga6BK 6IfUHVXxPf5V9GLYXIp8IrkS/A== X-Google-Smtp-Source: AGRyM1sqD+74x78pNU/99nk0upu3DkwfugwxLpJ3BEB8b0uYPQSB83MKO9zMzEFVBfKlPB7FGxJM+g== X-Received: by 2002:a2e:91c4:0:b0:25a:7256:a7aa with SMTP id u4-20020a2e91c4000000b0025a7256a7aamr4172820ljg.344.1656578636167; Thu, 30 Jun 2022 01:43:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 01:43:55 -0700 (PDT) From: Linus Walleij To: Andrew Morton Cc: linux-mm@kvack.org, Linus Walleij Subject: [PATCH 5/5] mm: nommu: Pass a pointer to virt_to_page() Date: Thu, 30 Jun 2022 10:41:24 +0200 Message-Id: <20220630084124.691207-6-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=1656578637; a=rsa-sha256; cv=none; b=QT1Spwx+LWfMhM+Y9uHdIKYNLNRWf5zYvtOayJS47rpbg3zuC0r5S2ZgXCR2c6oZo/uhvb DuxdbrlF0ytYspJI92dcov2Bnx2dD5Zr5JTrf9WBJd5NSI7x5vXM9DMRfVH+qAqNI8cZee y7nDGvHRUprXI8zsHtNG9FXWZc6RPgM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="BWPu/+9T"; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf15.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.176 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=1656578637; 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=8s0PQKdATgRrGcuVyDnYrmCWblAWXzSHruyiRsnHNJg=; b=bx8pBVilv/rwT4/V75wriAOUeQsG6y1DNX0Y6MymCAlTK2BRguxE2ZQBRzeXjAilZ8GZlN vDHGmjPObkqHklY2zC68NDvmNhTiawThZ3TG8YCleN50/KqdPtv05MKrTkyV6qk8lw/ps/ EITHI/jhtMfxYWfslx7PDYoz52SeHZs= Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="BWPu/+9T"; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf15.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.208.176 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7C3D1A002F X-Stat-Signature: x4x7ixdff41piog1s1h8ffz6fbycx31o X-Rspam-User: X-HE-Tag: 1656578637-628657 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/nommu.c: In function 'free_page_series': mm/nommu.c:501:50: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion] struct page *page = virt_to_page(from); Fix this with an explicit cast. Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Linus Walleij --- mm/nommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/nommu.c b/mm/nommu.c index 9d7afc2d959e..e819cbc21b39 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -500,7 +500,7 @@ static void delete_nommu_region(struct vm_region *region) static void free_page_series(unsigned long from, unsigned long to) { for (; from < to; from += PAGE_SIZE) { - struct page *page = virt_to_page(from); + struct page *page = virt_to_page((void *)from); atomic_long_dec(&mmap_pages_allocated); put_page(page);