lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220317175043.1972081-1-trix@redhat.com>
Date:   Thu, 17 Mar 2022 10:50:43 -0700
From:   trix@...hat.com
To:     konishi.ryusuke@...il.com, nathan@...nel.org,
        ndesaulniers@...gle.com
Cc:     linux-nilfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, Tom Rix <trix@...hat.com>
Subject: [PATCH] nilfs2: move initialization of nr_dirty to decl

From: Tom Rix <trix@...hat.com>

On clang build there is this error
inode.c:227:13: error: variable 'nr_dirty' is
  used uninitialized whenever 'if' condition is false
        } else if (ret) {
                   ^~~

In nilfs_dirty_folio(), if the call to
filemap_dirty_folio() fails and there
are no buffers, nr_dirty will be uninitialized.
Move the initialization out of the buffer
block and to the decl.

Signed-off-by: Tom Rix <trix@...hat.com>
---
 fs/nilfs2/inode.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index c1219c0678a57..01e58b65c9384 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -204,7 +204,7 @@ static bool nilfs_dirty_folio(struct address_space *mapping,
 {
 	struct inode *inode = mapping->host;
 	struct buffer_head *head;
-	unsigned int nr_dirty;
+	unsigned int nr_dirty = 0;
 	bool ret = filemap_dirty_folio(mapping, folio);
 
 	/*
@@ -214,8 +214,6 @@ static bool nilfs_dirty_folio(struct address_space *mapping,
 	head = folio_buffers(folio);
 	if (head) {
 		struct buffer_head *bh = head;
-
-		nr_dirty = 0;
 		do {
 			/* Do not mark hole blocks dirty */
 			if (buffer_dirty(bh) || !buffer_mapped(bh))
-- 
2.26.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ