[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4211c1ee2b854711b9ff03ddd8e82905@AcuMS.aculab.com>
Date: Tue, 11 Apr 2023 10:16:41 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Peng Zhang' <zhangpeng.00@...edance.com>,
Gang Li <ligang.bdlg@...edance.com>
CC: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
David Binderman <dcb314@...mail.com>
Subject: RE: [PATCH] maple_tree: Use correct variable type in sizeof
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)
Powered by blists - more mailing lists