From: Gang Li <ligang.bdlg@bytedance.com>
To: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org,
David Binderman <dcb314@hotmail.com>
Subject: Re: [PATCH] maple_tree: Use correct variable type in sizeof
Date: Mon, 10 Apr 2023 17:46:47 +0800 [thread overview]
Message-ID: <8b5af22d-1612-a2a0-02da-728f1fd57bf1@bytedance.com> (raw)
In-Reply-To: <20230410091431.74961-1-zhangpeng.00@bytedance.com>
On 2023/4/10 17:14, Peng Zhang wrote:
> The original code is:
> memset(pivs + tmp, 0, sizeof(unsigned long *) * (max_p - tmp));
>
> The type of variable pointed to by pivs is unsigned long, but the type
> used in sizeof is a pointer type. Change it to unsigned long.
>
Maybe add a fix tag?
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
> Suggested-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.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 88c44f6d6cee..b06fc5f19b31 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -3255,7 +3255,7 @@ static inline void mas_destroy_rebalance(struct ma_state *mas, unsigned char end
>
> if (tmp < max_p)
> memset(pivs + tmp, 0,
> - sizeof(unsigned long *) * (max_p - tmp));
> + sizeof(unsigned long) * (max_p - tmp));
>
> if (tmp < mt_slots[mt])
> memset(slots + tmp, 0, sizeof(void *) * (max_s - tmp));
next prev parent reply other threads:[~2023-04-10 9:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 9:14 Peng Zhang
2023-04-10 9:46 ` Gang Li [this message]
2023-04-10 10:09 ` Peng Zhang
2023-04-10 13:51 ` Matthew Wilcox
2023-04-11 10:16 ` David Laight
2023-04-10 12:58 ` Liam R. Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b5af22d-1612-a2a0-02da-728f1fd57bf1@bytedance.com \
--to=ligang.bdlg@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=dcb314@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=zhangpeng.00@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox