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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241009183519.36651-1-surajsonawane0215@gmail.com>
Date: Thu, 10 Oct 2024 00:05:19 +0530
From: SurajSonawane2415 <surajsonawane0215@...il.com>
To: dhowells@...hat.com,
	marc.dionne@...istor.com
Cc: linux-afs@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Suraj Sonawane <surajsonawane0215@...il.com>
Subject: [PATCH] fs: afs: Fix uninit 'count' in afs_deliver_fs_get_capabilities

From: Suraj Sonawane <surajsonawane0215@...il.com>

Fix the uninitialized symbol 'count' in the function
afs_deliver_fs_get_capabilities to resolve the error generated
with the smatch tool:

fs/afs/fsclient.c:1704 afs_deliver_fs_get_capabilities() error:
uninitialized symbol 'count'.

The error regarding the uninitialized count symbol in the
afs_deliver_fs_get_capabilities function arises due to the
control flow of the switch statement. Ensure that you
initialize count before its usage to avoid undefined behavior.

If unmarshall skips to cases 2 or 3, count remains
uninitialized and may contain a garbage value. This could lead
to errors flagged by static analysis tools like smatch.

By initializing count to zero, guarantee that it has a defined
value regardless of the control path taken, thereby enhancing
code reliability and preventing potential issues associated
with uninitialized variables.

Signed-off-by: Suraj Sonawane <surajsonawane0215@...il.com>
---
 fs/afs/fsclient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index 098fa034a..4ab41dcdb 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -1665,7 +1665,7 @@ int afs_fs_give_up_all_callbacks(struct afs_net *net, struct afs_server *server,
  */
 static int afs_deliver_fs_get_capabilities(struct afs_call *call)
 {
-	u32 count;
+	u32 count = 0;
 	int ret;
 
 	_enter("{%u,%zu}", call->unmarshall, iov_iter_count(call->iter));
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ