linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Binderman <dcb314@hotmail.com>
To: "Liam.Howlett@oracle.com" <Liam.Howlett@oracle.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: linux-6.3-rc6/lib/maple_tree.c: Two style issues
Date: Mon, 10 Apr 2023 07:05:47 +0000	[thread overview]
Message-ID: <DB6P189MB0568CB290411B23A176511239C959@DB6P189MB0568.EURP189.PROD.OUTLOOK.COM> (raw)

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



             reply	other threads:[~2023-04-10  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  7:05 David Binderman [this message]
2023-04-10  8:23 ` Peng Zhang
2023-04-17 14:22   ` David Binderman
2023-04-17 14: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=DB6P189MB0568CB290411B23A176511239C959@DB6P189MB0568.EURP189.PROD.OUTLOOK.COM \
    --to=dcb314@hotmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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