* [kdave-btrfs-devel:misc-next 32/57] fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
@ 2020-04-20 6:58 kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-04-20 6:58 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4304 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Qu Wenruo <wqu@suse.com>
CC: David Sterba <dsterba@suse.com>
tree: https://github.com/kdave/btrfs-devel.git misc-next
head: 8d833610d346fa2e4fa3b82a4641361ffd293533
commit: 7da90930f2e2f7113cbe17431a63a1a71a7e9325 [32/57] btrfs: backref: rename and move finish_upper_links()
:::::: branch date: 3 days ago
:::::: commit date: 5 days ago
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
fs/btrfs/backref.c:1630:7: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
ret = 0;
^
fs/btrfs/backref.c:1624:7: note: ret is assigned
ret = -ENOENT;
^
fs/btrfs/backref.c:1630:7: note: ret is overwritten
ret = 0;
^
>> fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
struct rb_node *rb_node;
^
fs/btrfs/backref.c:2970:18: note: Shadowed declaration
struct rb_node *rb_node;
^
fs/btrfs/backref.c:2996:19: note: Shadow variable
struct rb_node *rb_node;
^
# https://github.com/kdave/btrfs-devel/commit/7da90930f2e2f7113cbe17431a63a1a71a7e9325
git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
git remote update kdave-btrfs-devel
git checkout 7da90930f2e2f7113cbe17431a63a1a71a7e9325
vim +/rb_node +2996 fs/btrfs/backref.c
7da90930f2e2f7 Qu Wenruo 2020-03-23 2961
7da90930f2e2f7 Qu Wenruo 2020-03-23 2962 /*
7da90930f2e2f7 Qu Wenruo 2020-03-23 2963 * Finish the upwards linkage created by btrfs_backref_add_tree_node()
7da90930f2e2f7 Qu Wenruo 2020-03-23 2964 */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2965 int btrfs_backref_finish_upper_links(struct btrfs_backref_cache *cache,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2966 struct btrfs_backref_node *start)
7da90930f2e2f7 Qu Wenruo 2020-03-23 2967 {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2968 struct list_head *useless_node = &cache->useless_node;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2969 struct btrfs_backref_edge *edge;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2970 struct rb_node *rb_node;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2971 LIST_HEAD(pending_edge);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2972
7da90930f2e2f7 Qu Wenruo 2020-03-23 2973 ASSERT(start->checked);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2974
7da90930f2e2f7 Qu Wenruo 2020-03-23 2975 /* Insert this node to cache if it's not COW-only */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2976 if (!start->cowonly) {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2977 rb_node = rb_simple_insert(&cache->rb_root, start->bytenr,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2978 &start->rb_node);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2979 if (rb_node)
7da90930f2e2f7 Qu Wenruo 2020-03-23 2980 btrfs_backref_panic(cache->fs_info, start->bytenr,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2981 -EEXIST);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2982 list_add_tail(&start->lower, &cache->leaves);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2983 }
7da90930f2e2f7 Qu Wenruo 2020-03-23 2984
7da90930f2e2f7 Qu Wenruo 2020-03-23 2985 /*
7da90930f2e2f7 Qu Wenruo 2020-03-23 2986 * Use breadth first search to iterate all related edges.
7da90930f2e2f7 Qu Wenruo 2020-03-23 2987 *
7da90930f2e2f7 Qu Wenruo 2020-03-23 2988 * The starting points are all the edges of this node
7da90930f2e2f7 Qu Wenruo 2020-03-23 2989 */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2990 list_for_each_entry(edge, &start->upper, list[LOWER])
7da90930f2e2f7 Qu Wenruo 2020-03-23 2991 list_add_tail(&edge->list[UPPER], &pending_edge);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2992
7da90930f2e2f7 Qu Wenruo 2020-03-23 2993 while (!list_empty(&pending_edge)) {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2994 struct btrfs_backref_node *upper;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2995 struct btrfs_backref_node *lower;
7da90930f2e2f7 Qu Wenruo 2020-03-23 @2996 struct rb_node *rb_node;
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [kdave-btrfs-devel:misc-next 32/57] fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
@ 2020-04-20 7:34 kbuild test robot
2020-04-20 12:01 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2020-04-20 7:34 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4204 bytes --]
tree: https://github.com/kdave/btrfs-devel.git misc-next
head: 8d833610d346fa2e4fa3b82a4641361ffd293533
commit: 7da90930f2e2f7113cbe17431a63a1a71a7e9325 [32/57] btrfs: backref: rename and move finish_upper_links()
:::::: branch date: 3 days ago
:::::: commit date: 5 days ago
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
fs/btrfs/backref.c:1630:7: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
ret = 0;
^
fs/btrfs/backref.c:1624:7: note: ret is assigned
ret = -ENOENT;
^
fs/btrfs/backref.c:1630:7: note: ret is overwritten
ret = 0;
^
>> fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
struct rb_node *rb_node;
^
fs/btrfs/backref.c:2970:18: note: Shadowed declaration
struct rb_node *rb_node;
^
fs/btrfs/backref.c:2996:19: note: Shadow variable
struct rb_node *rb_node;
^
# https://github.com/kdave/btrfs-devel/commit/7da90930f2e2f7113cbe17431a63a1a71a7e9325
git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
git remote update kdave-btrfs-devel
git checkout 7da90930f2e2f7113cbe17431a63a1a71a7e9325
vim +/rb_node +2996 fs/btrfs/backref.c
7da90930f2e2f7 Qu Wenruo 2020-03-23 2961
7da90930f2e2f7 Qu Wenruo 2020-03-23 2962 /*
7da90930f2e2f7 Qu Wenruo 2020-03-23 2963 * Finish the upwards linkage created by btrfs_backref_add_tree_node()
7da90930f2e2f7 Qu Wenruo 2020-03-23 2964 */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2965 int btrfs_backref_finish_upper_links(struct btrfs_backref_cache *cache,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2966 struct btrfs_backref_node *start)
7da90930f2e2f7 Qu Wenruo 2020-03-23 2967 {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2968 struct list_head *useless_node = &cache->useless_node;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2969 struct btrfs_backref_edge *edge;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2970 struct rb_node *rb_node;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2971 LIST_HEAD(pending_edge);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2972
7da90930f2e2f7 Qu Wenruo 2020-03-23 2973 ASSERT(start->checked);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2974
7da90930f2e2f7 Qu Wenruo 2020-03-23 2975 /* Insert this node to cache if it's not COW-only */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2976 if (!start->cowonly) {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2977 rb_node = rb_simple_insert(&cache->rb_root, start->bytenr,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2978 &start->rb_node);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2979 if (rb_node)
7da90930f2e2f7 Qu Wenruo 2020-03-23 2980 btrfs_backref_panic(cache->fs_info, start->bytenr,
7da90930f2e2f7 Qu Wenruo 2020-03-23 2981 -EEXIST);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2982 list_add_tail(&start->lower, &cache->leaves);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2983 }
7da90930f2e2f7 Qu Wenruo 2020-03-23 2984
7da90930f2e2f7 Qu Wenruo 2020-03-23 2985 /*
7da90930f2e2f7 Qu Wenruo 2020-03-23 2986 * Use breadth first search to iterate all related edges.
7da90930f2e2f7 Qu Wenruo 2020-03-23 2987 *
7da90930f2e2f7 Qu Wenruo 2020-03-23 2988 * The starting points are all the edges of this node
7da90930f2e2f7 Qu Wenruo 2020-03-23 2989 */
7da90930f2e2f7 Qu Wenruo 2020-03-23 2990 list_for_each_entry(edge, &start->upper, list[LOWER])
7da90930f2e2f7 Qu Wenruo 2020-03-23 2991 list_add_tail(&edge->list[UPPER], &pending_edge);
7da90930f2e2f7 Qu Wenruo 2020-03-23 2992
7da90930f2e2f7 Qu Wenruo 2020-03-23 2993 while (!list_empty(&pending_edge)) {
7da90930f2e2f7 Qu Wenruo 2020-03-23 2994 struct btrfs_backref_node *upper;
7da90930f2e2f7 Qu Wenruo 2020-03-23 2995 struct btrfs_backref_node *lower;
7da90930f2e2f7 Qu Wenruo 2020-03-23 @2996 struct rb_node *rb_node;
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kdave-btrfs-devel:misc-next 32/57] fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
2020-04-20 7:34 [kdave-btrfs-devel:misc-next 32/57] fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable] kbuild test robot
@ 2020-04-20 12:01 ` Qu Wenruo
0 siblings, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2020-04-20 12:01 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4858 bytes --]
On 2020/4/20 下午3:34, kbuild test robot wrote:
> tree: https://github.com/kdave/btrfs-devel.git misc-next
> head: 8d833610d346fa2e4fa3b82a4641361ffd293533
> commit: 7da90930f2e2f7113cbe17431a63a1a71a7e9325 [32/57] btrfs: backref: rename and move finish_upper_links()
> :::::: branch date: 3 days ago
> :::::: commit date: 5 days ago
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
>
>
> cppcheck warnings: (new ones prefixed by >>)
>
> fs/btrfs/backref.c:1630:7: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
> ret = 0;
> ^
> fs/btrfs/backref.c:1624:7: note: ret is assigned
> ret = -ENOENT;
> ^
> fs/btrfs/backref.c:1630:7: note: ret is overwritten
> ret = 0;
> ^
This seems to be false alert.
The involved code looks like this:
btrfs_find_one_extref()
{
while (condition) {
ret = -ENOENT;
if (something_wrong1)
break;
if (something_wrong2)
break;
/* All passes, resetting ret to 0 */
ret = 0;
/* Do extra work */
}
return ret;
}
Although the style needs to re-worked, it is not wrong AFAIK.
I'll fix it soon.
>>> fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable]
> struct rb_node *rb_node;
> ^
> fs/btrfs/backref.c:2970:18: note: Shadowed declaration
> struct rb_node *rb_node;
> ^
> fs/btrfs/backref.c:2996:19: note: Shadow variable
> struct rb_node *rb_node;
> ^
>
> # https://github.com/kdave/btrfs-devel/commit/7da90930f2e2f7113cbe17431a63a1a71a7e9325
> git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
> git remote update kdave-btrfs-devel
> git checkout 7da90930f2e2f7113cbe17431a63a1a71a7e9325
> vim +/rb_node +2996 fs/btrfs/backref.c
>
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2961
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2962 /*
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2963 * Finish the upwards linkage created by btrfs_backref_add_tree_node()
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2964 */
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2965 int btrfs_backref_finish_upper_links(struct btrfs_backref_cache *cache,
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2966 struct btrfs_backref_node *start)
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2967 {
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2968 struct list_head *useless_node = &cache->useless_node;
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2969 struct btrfs_backref_edge *edge;
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2970 struct rb_node *rb_node;
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2971 LIST_HEAD(pending_edge);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2972
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2973 ASSERT(start->checked);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2974
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2975 /* Insert this node to cache if it's not COW-only */
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2976 if (!start->cowonly) {
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2977 rb_node = rb_simple_insert(&cache->rb_root, start->bytenr,
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2978 &start->rb_node);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2979 if (rb_node)
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2980 btrfs_backref_panic(cache->fs_info, start->bytenr,
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2981 -EEXIST);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2982 list_add_tail(&start->lower, &cache->leaves);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2983 }
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2984
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2985 /*
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2986 * Use breadth first search to iterate all related edges.
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2987 *
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2988 * The starting points are all the edges of this node
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2989 */
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2990 list_for_each_entry(edge, &start->upper, list[LOWER])
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2991 list_add_tail(&edge->list[UPPER], &pending_edge);
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2992
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2993 while (!list_empty(&pending_edge)) {
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2994 struct btrfs_backref_node *upper;
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 2995 struct btrfs_backref_node *lower;
> 7da90930f2e2f7 Qu Wenruo 2020-03-23 @2996 struct rb_node *rb_node;
This definitely needs fix.
Thanks,
Qu
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-20 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-20 7:34 [kdave-btrfs-devel:misc-next 32/57] fs/btrfs/backref.c:2996:19: warning: Local variable 'rb_node' shadows outer variable [shadowVariable] kbuild test robot
2020-04-20 12:01 ` Qu Wenruo
-- strict thread matches above, loose matches on Subject: below --
2020-04-20 6:58 kbuild test robot
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.