From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 233D68F57 for ; Sun, 16 Jul 2023 20:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F566C433C8; Sun, 16 Jul 2023 20:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689540338; bh=3y7/BJ1dCtwSdXWqU6VB8QYJUMiiM8mE6WtbiFW7h8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLsIOnUGMmWRnCODOAB7jIF2UuwSAfhyh1SFNMy/sjpHnPJSCIp/CdwdPpz/Jf+QD SC2m8aACsHgylxuZA9V1k+v2wGq19brChPumJEjhaH/QxdEBh+oiai6+qICKjtgdVQ Ue6Up/FJKUxyOdSCB1Gk8CRHrXufH862HHj2QaN0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Aneesh Kumar K.V" , Michael Ellerman , Sasha Levin , Sachin Sant Subject: [PATCH 6.1 328/591] powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary Date: Sun, 16 Jul 2023 21:47:47 +0200 Message-ID: <20230716194932.380268766@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230716194923.861634455@linuxfoundation.org> References: <20230716194923.861634455@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aneesh Kumar K.V [ Upstream commit c8eebc4a99f15280654f23e914e746c40a516e50 ] Without this fix, the last subsection vmemmap can end up in memory even if the namespace is created with -M mem and has sufficient space in the altmap area. Fixes: cf387d9644d8 ("libnvdimm/altmap: Track namespace boundaries in altmap") Signed-off-by: Aneesh Kumar K.V Tested-by: Sachin Sant > Signed-off-by: Michael Ellerman Link: https://msgid.link/20230616110826.344417-6-aneesh.kumar@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 05b0d584e50b8..fe1b83020e0df 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c @@ -189,7 +189,7 @@ static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long star unsigned long nr_pfn = page_size / sizeof(struct page); unsigned long start_pfn = page_to_pfn((struct page *)start); - if ((start_pfn + nr_pfn) > altmap->end_pfn) + if ((start_pfn + nr_pfn - 1) > altmap->end_pfn) return true; if (start_pfn < altmap->base_pfn) -- 2.39.2