+ mm-vmstat-fix-wenum-enum-conversion-warning-in-vmstath.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/vmstat: fix -Wenum-enum-conversion warning in vmstat.h
has been added to the -mm mm-unstable branch.  Its filename is
     mm-vmstat-fix-wenum-enum-conversion-warning-in-vmstath.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmstat-fix-wenum-enum-conversion-warning-in-vmstath.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Shivamurthy Shastri <shivamurthy.shastri@xxxxxxxxxxxxx>
Subject: mm/vmstat: fix -Wenum-enum-conversion warning in vmstat.h
Date: Fri, 21 Jun 2024 13:16:04 +0200

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.

Link: https://lkml.kernel.org/r/20240621111604.25330-1-shivamurthy.shastri@xxxxxxxxxxxxx
Signed-off-by: Shivamurthy Shastri <shivamurthy.shastri@xxxxxxxxxxxxx>
Reviewed-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/vmstat.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/vmstat.h~mm-vmstat-fix-wenum-enum-conversion-warning-in-vmstath
+++ a/include/linux/vmstat.h
@@ -495,7 +495,7 @@ static inline const char *node_stat_name
 
 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)
_

Patches currently in -mm which might be from shivamurthy.shastri@xxxxxxxxxxxxx are

mm-vmstat-fix-wenum-enum-conversion-warning-in-vmstath.patch





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux