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: <20240621111604.25330-1-shivamurthy.shastri@linutronix.de>
Date: Fri, 21 Jun 2024 13:16:04 +0200
From: Shivamurthy Shastri <shivamurthy.shastri@...utronix.de>
To: linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Cc: akpm@...ux-foundation.org,
	vbabka@...e.cz,
	willy@...radead.org,
	hannes@...xchg.org,
	anna-maria@...utronix.de,
	tglx@...utronix.de,
	shivamurthy.shastri@...utronix.de
Subject: [PATCH] mm/vmstat: Fix -Wenum-enum-conversion warning in vmstat.h

A W=1 build with -Wenum-enum-conversion enabled, results in the
following build warning due to an arithmetic operation between different
enumeration types 'enum node_stat_item' and 'enum lru_list':

  include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
    514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
        |                               ~~~~~~~~~~~ ^ ~~~

Address this by casting lru to the proper type.

Signed-off-by: Shivamurthy Shastri <shivamurthy.shastri@...utronix.de>
Reviewed-by: Anna-Maria Behnsen <anna-maria@...utronix.de>
---
 include/linux/vmstat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 735eae6e272c..72ecd46fd0c4 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -511,7 +511,7 @@ static inline const char *node_stat_name(enum node_stat_item item)
 
 static inline const char *lru_list_name(enum lru_list lru)
 {
-	return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
+	return node_stat_name(NR_LRU_BASE + (enum node_stat_item)lru) + 3; // skip "nr_"
 }
 
 static inline const char *writeback_stat_name(enum writeback_stat_item item)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ