linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* linux-6.3-rc6/lib/maple_tree.c: Two style issues
@ 2023-04-10  7:05 David Binderman
  2023-04-10  8:23 ` Peng Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: David Binderman @ 2023-04-10  7:05 UTC (permalink / raw)
  To: Liam.Howlett, linux-mm, Linux Kernel Mailing List

Hello there,

Static analyser cppcheck says:

1.

linux-6.3-rc6/lib/maple_tree.c:1951:21: style: Array index 'split' is used before limits check. [arrayIndexThenCheck]

Source code is 

        while (((bn->pivot[split] - min) < slot_count - 1) &&
               (split < slot_count - 1) && (b_end - split > slot_min))

Suggest move limits check to before use.

2.

linux-6.3-rc6/lib/maple_tree.c:3289:11: warning: Size of pointer 'pivs' used instead of size of its data. [pointerSize]

Source code is

           memset(pivs + tmp, 0,
                   sizeof(unsigned long *) * (max_p - tmp));

but

    unsigned long *l_pivs, *pivs, gap;

Pointers and long don't have to be the same size. Suggest code rework.

Regards

David Binderman



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

end of thread, other threads:[~2023-04-17 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-10  7:05 linux-6.3-rc6/lib/maple_tree.c: Two style issues David Binderman
2023-04-10  8:23 ` Peng Zhang
2023-04-17 14:22   ` David Binderman
2023-04-17 14:58     ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox