mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid
Subsystems (3)
PATCH 1/1 mm/page_alloc: Fix __alloc_size attribute for alloc_pages_exact_nid
From: Thibaut Sautereau <[email protected]>
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 <[email protected]>
Cc Kees Cook <[email protected]>
Cc Levente Polyak <[email protected]>
Signed-off-by Thibaut Sautereau <[email protected]>
--- include/linux/gfp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/gfp.h +1 -1
@@ -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)
Signature · 1 line
2.34.1
Quoted 10 lines · Thibaut Sautereau
From: Thibaut Sautereau <[email protected]>
The second parameter of
alloc_pages_exact_nidis 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 <[email protected]>Cc Kees Cook <[email protected]>Cc Levente Polyak <[email protected]>Signed-off-by Thibaut Sautereau <[email protected]>
Thanks! Andrew, can you take this?
Acked-by Kees Cook <[email protected]>
-Kees
Quoted 20 lines
--- include/linux/gfp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/gfp.h +1
-1@@ -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)Signature · 1 line
2.34.1
Signature · 1 line
Kees Cook