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);