From patchwork Tue Dec 14 16:21:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thibaut Sautereau X-Patchwork-Id: 12676321 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 55C95C433EF for ; Tue, 14 Dec 2021 16:21:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4ED96B0071; Tue, 14 Dec 2021 11:21:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BFE7A6B0073; Tue, 14 Dec 2021 11:21:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AEE1C6B0074; Tue, 14 Dec 2021 11:21:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0111.hostedemail.com [216.40.44.111]) by kanga.kvack.org (Postfix) with ESMTP id 9CE346B0071 for ; Tue, 14 Dec 2021 11:21:38 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 537CD82FE5 for ; Tue, 14 Dec 2021 16:21:28 +0000 (UTC) X-FDA: 78916915056.06.4CD89D4 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by imf13.hostedemail.com (Postfix) with ESMTP id B056F20015 for ; Tue, 14 Dec 2021 16:21:23 +0000 (UTC) Received: (Authenticated sender: thibaut.sautereau@clip-os.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 6D367240006; Tue, 14 Dec 2021 16:21:23 +0000 (UTC) Date: Tue, 14 Dec 2021 17:21:23 +0100 From: Thibaut Sautereau To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Daniel Micay , Kees Cook , Levente Polyak , Thibaut Sautereau Subject: [PATCH] mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid Message-ID: MIME-Version: 1.0 Content-Disposition: inline Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf13.hostedemail.com: domain of thibaut.sautereau@clip-os.org designates 217.70.183.193 as permitted sender) smtp.mailfrom=thibaut.sautereau@clip-os.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B056F20015 X-Stat-Signature: 3onznzrqqf3x3wu4gne7wp1kybute11p X-HE-Tag: 1639498883-463949 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: From: Thibaut Sautereau The second parameter of alloc_pages_exact_nid is the one indicating the size of memory pointed by the returned pointer. Fixes: abd58f38dfb4 ("mm/page_alloc: add __alloc_size attributes for better bounds checking") Cc: Daniel Micay Cc: Kees Cook Cc: Levente Polyak Signed-off-by: Thibaut Sautereau Acked-by: Kees Cook --- include/linux/gfp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index b976c4177299..8fcc38467af6 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -624,7 +624,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask); void *alloc_pages_exact(size_t size, gfp_t gfp_mask) __alloc_size(1); void free_pages_exact(void *virt, size_t size); -__meminit void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) __alloc_size(1); +__meminit void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) __alloc_size(2); #define __get_free_page(gfp_mask) \ __get_free_pages((gfp_mask), 0)