* [PATCH] mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid
@ 2021-12-14 16:21 Thibaut Sautereau
2021-12-14 17:06 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Thibaut Sautereau @ 2021-12-14 16:21 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel
Cc: Daniel Micay, Kees Cook, Levente Polyak, Thibaut Sautereau
From: Thibaut Sautereau <thibaut.sautereau@ssi.gouv.fr>
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 <danielmicay@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Levente Polyak <levente@leventepolyak.net>
Signed-off-by: Thibaut Sautereau <thibaut.sautereau@ssi.gouv.fr>
---
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)
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid
2021-12-14 16:21 [PATCH] mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid Thibaut Sautereau
@ 2021-12-14 17:06 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2021-12-14 17:06 UTC (permalink / raw)
To: Thibaut Sautereau
Cc: Andrew Morton, linux-mm, linux-kernel, Daniel Micay,
Levente Polyak, Thibaut Sautereau
On Tue, Dec 14, 2021 at 05:21:23PM +0100, Thibaut Sautereau wrote:
> From: Thibaut Sautereau <thibaut.sautereau@ssi.gouv.fr>
>
> 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 <danielmicay@gmail.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Levente Polyak <levente@leventepolyak.net>
> Signed-off-by: Thibaut Sautereau <thibaut.sautereau@ssi.gouv.fr>
Thanks! Andrew, can you take this?
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> 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)
> --
> 2.34.1
>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-14 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 16:21 [PATCH] mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid Thibaut Sautereau
2021-12-14 17:06 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox