Message ID | 20240213101733.461544-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp441299dyb; Tue, 13 Feb 2024 02:17:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+2AbplA9kIBThQaP6lGCl7NlJOXG9l2JPO7XxzQcVrE5DUvGCt4SBQhDpYKyQ8INyK+x3 X-Received: by 2002:a05:622a:1306:b0:42c:d9e:3316 with SMTP id v6-20020a05622a130600b0042c0d9e3316mr12323076qtk.4.1707819478717; Tue, 13 Feb 2024 02:17:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707819478; cv=pass; d=google.com; s=arc-20160816; b=WPcELfejxHOh80PavogzBggwyGrbMeKaWFWyB5G7IXjA1gjo+eouJrV9g5SgsvyBvH Fqq7DcFxtRVz7uAaotd9TdA/U52swqfIUq/HDKUN+D1au8xXvW2IqQp3ejP691KxtC8H 72RyQapfTt3K1S/XO8ctamuw7ZA2gslgytzeabuo/c1Ov+cofZUjw2pNdLGpJwoZfRGH DSBj0QYn3NT5rafCxnjm/8/q4sfTMJh8kyRWRYC1v51woo3bYEGP8nrONm2+hyOlscuj Yo3LKx/6T7tk6iVFI5AkhApebLFL47a2Qg+wDmG1QZJp/kmSdoRxIme41pUC4zSQFSN4 aWFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=wN+/qhHzwUoiJ12jHQid2Iv5evqadbysnb5i9GBBNKA=; fh=oYDEvYLLYbj2HucyIgJhxYxxVXS//O/1Ae6FlpaQo34=; b=BhvDYaOrwRi5YAqD1xhvVRAGzLk9kAl8KnhiN1bORdj6Ye2dp0Tj6RMNnYL+CEP+tI VIPKiyJt+1kYxHis3PkDGNCCGnx5/nSqgaQDra5+Dg4ieo98NDew+BA9dEt/O0Cp6bmg irah7ZEzlMsaPZv/aryAHM4urCvHW/DRfh2t3uz6i9a8SzHX7yxoJ65ALN0RXRJrJoZH z2Tf3COAb8c/mbRYQ1mZa3rFFEzFO/b58WqKZARejeXkrAM8Rt1oyQTyCQFW4HtNMANX EnlJUliJvUslrmulHmMXD+vOn+k9LnsUnTwu0vXVFEwccJxQ7PQxALpIlogDR+tn1FVw eERw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L2TrOChC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCV45uMnLNavc4rdCNQTHpEWPpgCoDgFPmPiZB64B1DyWFCncapo7f1ww0ZcvyGvPE7dX/UsszchrVLkEDYHUavpdb32rw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h21-20020ac846d5000000b0042c7edd2bc3si2387963qto.21.2024.02.13.02.17.58 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:17:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L2TrOChC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63329-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 81F901C21917 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 10:17:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 666CF22F14; Tue, 13 Feb 2024 10:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L2TrOChC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0651225CE for <linux-kernel@vger.kernel.org>; Tue, 13 Feb 2024 10:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707819457; cv=none; b=LACSxVaSDqkOl+4B8p4K8FTM+o74qaNoOuT7HLZ/EF1dC4op2ObNBMvtt9fhUJF0cWz4VSNCPZIXnxS8D/p9U/I7C/2B6B4sDtDisO/IYoYKUnL526zES2ud0Td5tRfshPR25CgEMTJRA206WIcabdkehCbbTWLRnVg/2RjyaUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707819457; c=relaxed/simple; bh=SmIMSf7PRLHS1bKoo/5RP9uj4icwbgQjnEsI14pJqnA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EUSw30B0Z7QiF7Dh6EIhpg1PZ8S0Jl/LM/U0yKxAW8o63YRgi6XLer/EEF9x/XEtz+lKl4jWK4n/7aKDjFwTMuxvsRGEnbhpgkqNPdD1XabeoGia02IjpUL8v/0jjUTP30hz9TC0F2GEFcRNyEQnmnpAa9rXE4tYTWblt1STNv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L2TrOChC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72D56C433C7; Tue, 13 Feb 2024 10:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707819457; bh=SmIMSf7PRLHS1bKoo/5RP9uj4icwbgQjnEsI14pJqnA=; h=From:To:Cc:Subject:Date:From; b=L2TrOChCRvMze16kk6fVZ/kj/Khuup7S7CcrYFegLwm5yHyYM3y5CiDvoDqNWoOOC wY4hOZYkHZbmfHqGYb+DCtqUdysls2exfIZ7mrWdDQhr/x0BMBEoifbmbcyO10qOnM WhGhGm2AYVkDdtzJKzyR428W2dgEidHKBGVl8ldqJZCgHdIttt5riZuJRfaXuSo9e/ RQXcmFi6An9gMxYKzZfkeswQ/X8fbMmvS3VEsgddnUc1PJA+d//SrU7F/NCbxxj6wE x6SkUiX8HeIgDn3LIe3lrgb1zEQv+3EQ8IFmjbs1mDcmKxG45WMAElz2ZLvhACIc/Q 32QJNhOa4ojUQ== From: Arnd Bergmann <arnd@kernel.org> To: Jan Kara <jack@suse.com> Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org Subject: [PATCH] quota: avoid printing an uninitialized blk number Date: Tue, 13 Feb 2024 11:17:28 +0100 Message-Id: <20240213101733.461544-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790778517931296992 X-GMAIL-MSGID: 1790778517931296992 |
Series |
quota: avoid printing an uninitialized blk number
|
|
Commit Message
Arnd Bergmann
Feb. 13, 2024, 10:17 a.m. UTC
From: Arnd Bergmann <arnd@arndb.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@arndb.de> --- fs/quota/quota_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue 13-02-24 11:17:28, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.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@arndb.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 >
On Tue, Feb 13, 2024, at 11:21, Jan Kara wrote: > On Tue 13-02-24 11:17:28, Arnd Bergmann wrote: >> From: Arnd Bergmann <arnd@arndb.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@arndb.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 :) 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
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,