From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [linux-next:master 9762/11953] mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)'
Date: Mon, 14 Mar 2022 16:30:38 +0300 [thread overview]
Message-ID: <20220314133038.GS3315@kadam> (raw)
In-Reply-To: <Yi1tzd6m6o6liiKN@casper.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1956 bytes --]
On Sun, Mar 13, 2022 at 04:06:37AM +0000, Matthew Wilcox wrote:
> On Sun, Mar 13, 2022 at 11:01:09AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: 71941773e143369a73c9c4a3b62fbb60736a1182
> > commit: b786e44a4dbfe64476e7120ec7990b89a37be37d [9762/11953] mm: Convert page_vma_mapped_walk to work on PFNs
> > config: riscv-randconfig-m031-20220312 (https://download.01.org/0day-ci/archive/20220313/202203131056.WINF40Gt-lkp(a)intel.com/config )
> > compiler: riscv64-linux-gcc (GCC) 11.2.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > smatch warnings:
> > mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)'
>
> Looks like a duplicate of https://lore.kernel.org/lkml/YgpzPru8aFA5sHOI(a)casper.infradead.org/
>
> Dan, any thoughts? Do you consider this a false positive from smatch?
>
That's really weird that HPAGE_PMD_NR ends up as zero... Does it wrap
to zero?
Anyway, it would be easy to silence the warning based on that it's on an
impossible path but I think that's not the right idea.
if (is_impossible_path())
return;
A lot of the bugs that Smatch finds are in impossible to reach error
handling code. I'll instead silence it based on that the macro
definition changes. Add it to smatch_data/kernel.unconstant_macros:
- if (!possibly_false_rl(rl_left, expr->op, rl_right)) {
+ if (!possibly_false_rl(rl_left, expr->op, rl_right) &&
+ !is_unconstant_macro(expr->left) &&
+ !is_unconstant_macro(expr->right)) {
char *name = expr_to_str(expr);
sm_warning("always true condition '(%s) => (%s %s %s)'", name,
I'll test this out overnight, tonight.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: kernel test robot <lkp@intel.com>,
kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 9762/11953] mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)'
Date: Mon, 14 Mar 2022 16:30:38 +0300 [thread overview]
Message-ID: <20220314133038.GS3315@kadam> (raw)
In-Reply-To: <Yi1tzd6m6o6liiKN@casper.infradead.org>
On Sun, Mar 13, 2022 at 04:06:37AM +0000, Matthew Wilcox wrote:
> On Sun, Mar 13, 2022 at 11:01:09AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: 71941773e143369a73c9c4a3b62fbb60736a1182
> > commit: b786e44a4dbfe64476e7120ec7990b89a37be37d [9762/11953] mm: Convert page_vma_mapped_walk to work on PFNs
> > config: riscv-randconfig-m031-20220312 (https://download.01.org/0day-ci/archive/20220313/202203131056.WINF40Gt-lkp@intel.com/config )
> > compiler: riscv64-linux-gcc (GCC) 11.2.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > smatch warnings:
> > mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)'
>
> Looks like a duplicate of https://lore.kernel.org/lkml/YgpzPru8aFA5sHOI@casper.infradead.org/
>
> Dan, any thoughts? Do you consider this a false positive from smatch?
>
That's really weird that HPAGE_PMD_NR ends up as zero... Does it wrap
to zero?
Anyway, it would be easy to silence the warning based on that it's on an
impossible path but I think that's not the right idea.
if (is_impossible_path())
return;
A lot of the bugs that Smatch finds are in impossible to reach error
handling code. I'll instead silence it based on that the macro
definition changes. Add it to smatch_data/kernel.unconstant_macros:
- if (!possibly_false_rl(rl_left, expr->op, rl_right)) {
+ if (!possibly_false_rl(rl_left, expr->op, rl_right) &&
+ !is_unconstant_macro(expr->left) &&
+ !is_unconstant_macro(expr->right)) {
char *name = expr_to_str(expr);
sm_warning("always true condition '(%s) => (%s %s %s)'", name,
I'll test this out overnight, tonight.
regards,
dan carpenter
next prev parent reply other threads:[~2022-03-14 13:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-13 3:01 [linux-next:master 9762/11953] mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)' kernel test robot
2022-03-13 4:06 ` Matthew Wilcox
2022-03-13 4:06 ` Matthew Wilcox
2022-03-14 13:30 ` Dan Carpenter [this message]
2022-03-14 13:30 ` Dan Carpenter
2022-03-14 13:36 ` Matthew Wilcox
2022-03-14 13:36 ` Matthew Wilcox
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=20220314133038.GS3315@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.