From: Andrew Morton <akpm@linux-foundation.org>
To: Rong Tao <rtoax@foxmail.com>
Cc: Rong Tao <rongtao@cestc.cn>, wuchi <wuchi.zero@gmail.com>,
linux-kernel@vger.kernel.org (open list),
linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] radix tree test suite: Fix uninitialized variable compilation warning
Date: Wed, 9 Nov 2022 16:23:48 -0800 [thread overview]
Message-ID: <20221109162348.3dbde3a7942c303af012276c@linux-foundation.org> (raw)
In-Reply-To: <tencent_DF74099967595DCEA93CBDC28D062026180A@qq.com>
On Wed, 9 Nov 2022 22:34:25 +0800 Rong Tao <rtoax@foxmail.com> wrote:
> [PATCH] radix tree test suite: Fix uninitialized variable compilation warning
This is not the test suite.
> We need to set an initial value for offset to eliminate compilation
> warning.
>
> How to reproduce warning:
>
> $ make -C tools/testing/radix-tree
> radix-tree.c: In function ‘radix_tree_tag_clear’:
> radix-tree.c:1046:17: warning: ‘offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 1046 | node_tag_clear(root, parent, tag, offset);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ...
>
> --- a/lib/radix-tree.c
> +++ b/lib/radix-tree.c
> @@ -1029,7 +1029,7 @@ void *radix_tree_tag_clear(struct radix_tree_root *root,
> {
> struct radix_tree_node *node, *parent;
> unsigned long maxindex;
> - int offset;
> + int offset = 0;
>
> radix_tree_load_root(root, &node, &maxindex);
> if (index > maxindex)
Are we sure this isn't actually a bug? What happens if the tree is empty?
next parent reply other threads:[~2022-11-10 0:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_DF74099967595DCEA93CBDC28D062026180A@qq.com>
2022-11-10 0:23 ` Andrew Morton [this message]
2022-11-10 5:00 ` [PATCH] lib/radix-tree: " Rong Tao
2022-11-10 16:06 ` Matthew Wilcox
2022-11-11 2:11 ` Rong Tao
2022-11-10 16:06 ` [PATCH] radix tree test suite: " 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=20221109162348.3dbde3a7942c303af012276c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=willy@infradead.org \
--cc=wuchi.zero@gmail.com \
/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