Skip to contentSkip to conversation

quota: avoid printing an uninitialized blk number

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 13, 2024 Diskquota

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota: avoid printing an uninitialized blk number

From: Arnd Bergmann <[email protected]>

The error path of find_tree_dqentry() now prints a variable that is never initialized:

fs/quota/quota_tree.c:674:8: error: variable 'blk' is uninitialized when used here [-Werror,-Wuninitialized]

                            blk);
                            ^~~
include/linux/quotaops.h:34:41: note: expanded from macro 'quota_error'
        __quota_error((sb), __func__, fmt , ## args)
                                               ^~~~

Move the calculation of the block number slightly up to make it show a sensible number.

Fixes 223bfb57631b ("quota: Detect loops in quota tree")
---
 fs/quota/quota_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/quota/quota_tree.c +1 -1
index afceef3ddfaa..05ae39f9b1ac 100644
@@ -669,13 +669,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
 	if (!buf)
 		return -ENOMEM;
 	ret = read_blk(info, blks[depth], buf);
+	blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
 	if (ret < 0) {
 		quota_error(dquot->dq_sb, "Can't read quota tree block %u",
 			    blks[depth]);
 		goto out_buf;
 	}
 	ret = 0;
-	blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
 	if (!blk)	/* No reference? */
 		goto out_buf;
 	ret = do_check_range(dquot->dq_sb, "block", blk, QT_TREEOFF,
Signature · 1 line
2.39.2
#1 lore raw
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The error path of find_tree_dqentry() now prints a variable that is never initialized:

fs/quota/quota_tree.c:674:8: error: variable 'blk' is uninitialized when used here [-Werror,-Wuninitialized]

                            blk);
                            ^~~
include/linux/quotaops.h:34:41: note: expanded from macro 'quota_error'
        __quota_error((sb), __func__, fmt , ## args)
                                               ^~~~
Quoted 5 lines

Move the calculation of the block number slightly up to make it show a sensible number.

Fixes 223bfb57631b ("quota: Detect loops in quota tree")

Arnd, this should be fixed in my tree as of yesterday and I can see that you've even based your patch on a fixed kernel :)

Honza

Quoted 26 lines
---
 fs/quota/quota_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/quota/quota_tree.c +1 -1
index afceef3ddfaa..05ae39f9b1ac 100644
@@ -669,13 +669,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
 	if (!buf)
 		return -ENOMEM;
 	ret = read_blk(info, blks[depth], buf);
+	blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
 	if (ret < 0) {
 		quota_error(dquot->dq_sb, "Can't read quota tree block %u",
 			    blks[depth]);
 		goto out_buf;
 	}
 	ret = 0;
-	blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
 	if (!blk)	/* No reference? */
 		goto out_buf;
 	ret = do_check_range(dquot->dq_sb, "block", blk, QT_TREEOFF,
Signature · 1 line
2.39.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw
Quoted 13 lines · Jan Kara
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The error path of find_tree_dqentry() now prints a variable that is never initialized:

fs/quota/quota_tree.c:674:8: error: variable 'blk' is uninitialized when used here [-Werror,-Wuninitialized]

                            blk);
                            ^~~
include/linux/quotaops.h:34:41: note: expanded from macro 'quota_error'
        __quota_error((sb), __func__, fmt , ## args)
                                               ^~~~
Quoted 8 lines
Quoted 5 lines

Move the calculation of the block number slightly up to make it show a sensible number.

Fixes 223bfb57631b ("quota: Detect loops in quota tree")

Arnd, this should be fixed in my tree as of yesterday and I can see that you've even based your patch on a fixed kernel :)

Right, sorry about that. I did a lot of fixes yesterday and sent them out after making sure they did not cause any new failures in an overnight test build, but did not check carefully during rebasing.

Arnd