fs/btrfs/qgroup.c:1616:18: warning: array subscript is below array bounds

From: kbuild test robot
Date: Mon Dec 26 2016 - 18:13:31 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b4b8664d291ac1998e0f0bcdc96b6397f0fe68b3
commit: 33d1f05ccb698aa92db3e64a639ce523cf18a408 btrfs: Export and move leaf/subtree qgroup helpers to qgroup.c
date: 4 weeks ago
config: x86_64-randconfig-in0-12270518 (attached as .config)
compiler: gcc-4.6 (Debian 4.6.4-7) 4.6.4
reproduce:
git checkout 33d1f05ccb698aa92db3e64a639ce523cf18a408
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.

All warnings (new ones prefixed by >>):

fs/btrfs/qgroup.c: In function 'adjust_slots_upwards.isra.13':
>> fs/btrfs/qgroup.c:1616:18: warning: array subscript is below array bounds [-Warray-bounds]
fs/btrfs/qgroup.c:1617:2: warning: array subscript is below array bounds [-Warray-bounds]

vim +1616 fs/btrfs/qgroup.c

1600 free_extent_buffer(eb);
1601 path->nodes[level] = NULL;
1602 path->slots[level] = 0;
1603 }
1604 } else {
1605 /*
1606 * We have a valid slot to walk back down
1607 * from. Stop here so caller can process these
1608 * new nodes.
1609 */
1610 break;
1611 }
1612
1613 level++;
1614 }
1615
> 1616 eb = path->nodes[root_level];
1617 if (path->slots[root_level] >= btrfs_header_nritems(eb))
1618 return 1;
1619
1620 return 0;
1621 }
1622
1623 int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans,
1624 struct btrfs_root *root,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip