linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] maple_tree: Fix mas_alloc_nodes()
@ 2022-08-02 19:36 Liam Howlett
  2022-08-06 15:12 ` Dmitry Osipenko
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Howlett @ 2022-08-02 19:36 UTC (permalink / raw)
  To: maple-tree, linux-mm, linux-kernel, Andrew Morton, Dmitry Osipenko

Use MAPLE_ALLOC_SLOTS, which differs on 32bit.  This was causing an
out of bounds issue on 32bit bulk allocations

Fixes: 06b152b7980a (Maple Tree: add new data structure)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 4e41f3394114..032e7bb0d44f 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -1242,7 +1242,7 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp)
 
 	node = mas->alloc;
 	while (requested) {
-		max_req = MAPLE_NODE_SLOTS - 1;
+		max_req = MAPLE_ALLOC_SLOTS;
 		if (node->slot[0]) {
 			unsigned int offset = node->node_count + 1;
 
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] maple_tree: Fix mas_alloc_nodes()
  2022-08-02 19:36 [PATCH] maple_tree: Fix mas_alloc_nodes() Liam Howlett
@ 2022-08-06 15:12 ` Dmitry Osipenko
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Osipenko @ 2022-08-06 15:12 UTC (permalink / raw)
  To: Liam Howlett, maple-tree, linux-mm, linux-kernel, Andrew Morton

02.08.2022 22:36, Liam Howlett пишет:
> Use MAPLE_ALLOC_SLOTS, which differs on 32bit.  This was causing an
> out of bounds issue on 32bit bulk allocations
> 
> Fixes: 06b152b7980a (Maple Tree: add new data structure)
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 4e41f3394114..032e7bb0d44f 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1242,7 +1242,7 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp)
>  
>  	node = mas->alloc;
>  	while (requested) {
> -		max_req = MAPLE_NODE_SLOTS - 1;
> +		max_req = MAPLE_ALLOC_SLOTS;
>  		if (node->slot[0]) {
>  			unsigned int offset = node->node_count + 1;
>  

Hello Liam,

This fixed the bug, thank you!

Tested-by: Dmitry Osipenko <digetx@gmail.com> # ARM32 Tegra

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-06 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 19:36 [PATCH] maple_tree: Fix mas_alloc_nodes() Liam Howlett
2022-08-06 15:12 ` Dmitry Osipenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).