From: David Laight <David.Laight@ACULAB.COM>
To: 'Peng Zhang' <zhangpeng.00@bytedance.com>,
Gang Li <ligang.bdlg@bytedance.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>,
David Binderman <dcb314@hotmail.com>
Subject: RE: [PATCH] maple_tree: Use correct variable type in sizeof
Date: Tue, 11 Apr 2023 10:16:41 +0000 [thread overview]
Message-ID: <4211c1ee2b854711b9ff03ddd8e82905@AcuMS.aculab.com> (raw)
In-Reply-To: <b1ea2c08-8e88-e04f-417b-4cf0daa417b1@bytedance.com>
From: Peng Zhang
> Sent: 10 April 2023 11:09
>
> 在 2023/4/10 17:46, Gang Li 写道:
> > 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")
>
> Maybe sizeof(void *) is equal to sizeof(unsigned long)
> in most architectures, so I don't know if it counts as a fix.
Might be worth adding; "Fortunately the sizes are the same."
> >> if (tmp < max_p)
> >> memset(pivs + tmp, 0,
> >> - sizeof(unsigned long *) * (max_p - tmp));
> >> + sizeof(unsigned long) * (max_p - tmp));
sizeof (*pivs)
> >> if (tmp < mt_slots[mt])
> >> memset(slots + tmp, 0, sizeof(void *) * (max_s - tmp));
and sizeof (*slots)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-04-11 10:16 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
2023-04-10 10:09 ` Peng Zhang
2023-04-10 13:51 ` Matthew Wilcox
2023-04-11 10:16 ` David Laight [this message]
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=4211c1ee2b854711b9ff03ddd8e82905@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=dcb314@hotmail.com \
--cc=ligang.bdlg@bytedance.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