From: Andrew Morton <akpm@linux-foundation.org>
To: kernel test robot <lkp@intel.com>
Cc: Oscar Salvador <osalvador@suse.de>,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 2908/3314] lib/stackdepot.c:544 stack_print() warn: unsigned 'stack->size' is never less than zero.
Date: Thu, 18 May 2023 13:32:47 -0700 [thread overview]
Message-ID: <20230518133247.a0ece8de7c3fc5dca9e1b67d@linux-foundation.org> (raw)
In-Reply-To: <202305182345.LTMlWG84-lkp@intel.com>
On Thu, 18 May 2023 23:44:10 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 798d276b39e984345d52b933a900a71fa0815928
> commit: e435b85a4aea7a82259105d5d8025655460052e1 [2908/3314] mm, page_owner: add page_owner_stacks file to print out only stacks and their counte
> config: x86_64-randconfig-m001
> compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202305182345.LTMlWG84-lkp@intel.com/
>
> smatch warnings:
> lib/stackdepot.c:544 stack_print() warn: unsigned 'stack->size' is never less than zero.
>
Linus would complain about that warning.
>
> 537
> 538 int stack_print(struct seq_file *m, void *v)
> 539 {
> 540 char *buf;
> 541 int ret = 0;
> 542 struct stack_record *stack = v;
> 543
> > 544 if (!stack->size || stack->size < 0 ||
> 545 stack->size > PAGE_SIZE || stack->handle.valid != 1 ||
> 546 refcount_read(&stack->count) < 1)
How about <=?
--- a/lib/stackdepot.c~mm-page_owner-add-page_owner_stacks-file-to-print-out-only-stacks-and-their-counte-fix-fix
+++ a/lib/stackdepot.c
@@ -541,9 +541,8 @@ int stack_print(struct seq_file *m, void
int ret = 0;
struct stack_record *stack = v;
- if (!stack->size || stack->size < 0 ||
- stack->size > PAGE_SIZE || stack->handle.valid != 1 ||
- refcount_read(&stack->count) < 1)
+ if (stack->size <= 0 || stack->size > PAGE_SIZE ||
+ stack->handle.valid != 1 || refcount_read(&stack->count) < 1)
return 0;
buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
_
next prev parent reply other threads:[~2023-05-18 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 15:44 kernel test robot
2023-05-18 20:32 ` Andrew Morton [this message]
2023-05-19 7:21 ` Dan Carpenter
2023-05-19 7:55 ` Dan Carpenter
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=20230518133247.a0ece8de7c3fc5dca9e1b67d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=osalvador@suse.de \
/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