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]
Date:   Tue, 26 Oct 2021 10:14:59 +0000
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     hare@...e.de, jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] scsi: fcoe: Fix implicit type conversion

The variable 'selected_cpu' is defined as unsigned int.
However 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.

Fixes: 064287e ("[SCSI] fcoe: Round-robin based selection of CPU for post-processing of incoming commands")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/scsi/fcoe/fcoe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 89ec735..2479dc1 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1311,7 +1311,7 @@ static void fcoe_thread_cleanup_local(unsigned int cpu)
  */
 static inline unsigned int fcoe_select_cpu(void)
 {
-	static unsigned int selected_cpu;
+	static int selected_cpu;
 
 	selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
 	if (selected_cpu >= nr_cpu_ids)
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ