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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204160921.377178-1-d-gole@ti.com>
Date: Tue, 4 Feb 2025 21:39:21 +0530
From: Dhruva Gole <d-gole@...com>
To: Frederic Weisbecker <frederic@...nel.org>,
        Andrew Morton
	<akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>
CC: Chen Yu <yu.c.chen@...el.com>, <linux-kernel@...r.kernel.org>,
        Kees Cook
	<kees@...nel.org>, Randy Dunlap <rdunlap@...radead.org>,
        Dhruva Gole
	<d-gole@...com>
Subject: [PATCH V2] kthread: Fix build warning variable 'ret' set but not used

Fix the following build time warning in kthread:

   kernel/kthread.c: In function 'kthread_affine_preferred':
>> kernel/kthread.c:861:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     861 |         int ret;
         |             ^~~

Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501301528.t0cZVbnq-lkp@intel.com/
Signed-off-by: Dhruva Gole <d-gole@...com>
---
Link to v1:
https://lore.kernel.org/lkml/20250204090838.214647-1-d-gole@ti.com/

Changelog:
- Use ret value toward the end return as per Kees' suggestion

---

 kernel/kthread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 4005b13ebd7f..5dc5b0d7238e 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -859,7 +859,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
 	struct kthread *kthread = to_kthread(p);
 	cpumask_var_t affinity;
 	unsigned long flags;
-	int ret;
+	int ret = 0;
 
 	if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE) || kthread->started) {
 		WARN_ON(1);
@@ -892,7 +892,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
 out:
 	free_cpumask_var(affinity);
 
-	return 0;
+	return ret;
 }
 
 /*

base-commit: 40b8e93e17bff4a4e0cc129e04f9fdf5daa5397e
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ