[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240213102139.gnfh5sq24rwu7wnp@quack3>
Date: Tue, 13 Feb 2024 11:21:39 +0100
From: Jan Kara <jack@...e.cz>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Jan Kara <jack@...e.com>, Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] quota: avoid printing an uninitialized blk number
On Tue 13-02-24 11:17:28, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
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
> ---
> fs/quota/quota_tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
> index afceef3ddfaa..05ae39f9b1ac 100644
> --- a/fs/quota/quota_tree.c
> +++ b/fs/quota/quota_tree.c
> @@ -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,
> --
> 2.39.2
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists