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>] [day] [month] [year] [list]
Message-Id: <1635476853-1849088-1-git-send-email-jiasheng@iscas.ac.cn>
Date:   Fri, 29 Oct 2021 03:07:33 +0000
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     peterz@...radead.org, valentin.schneider@....com,
        bristot@...hat.com
Cc:     linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] stop_machine: Fix implicit type conversion

The variable 'cpu' is defined as unsigned int.
However in the for_each_cpu, its values is assigned to -1.
That doesn't make sense and in the cpumask_next() it is implicitly
type conversed to int.
It is universally accepted that the implicit type conversion is
terrible.
Also, having the good programming custom will set an example for
others.
Thus, it might be better to change the definition of 'cpu' from
unsigned int to int.

Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 kernel/stop_machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index cbc3027..db6ea9f 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -393,7 +393,7 @@ static bool queue_stop_cpus_work(const struct cpumask *cpumask,
 				 struct cpu_stop_done *done)
 {
 	struct cpu_stop_work *work;
-	unsigned int cpu;
+	int cpu;
 	bool queued = false;
 
 	/*
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ