Patch "tools: ynl-gen: fix enum index in _decode_enum(..)" has been added to the 6.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    tools: ynl-gen: fix enum index in _decode_enum(..)

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tools-ynl-gen-fix-enum-index-in-_decode_enum.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2fc9cc6caba918a041a764b703174e29aee5d06c
Author: Arkadiusz Kubalewski <arkadiusz.kubalewski@xxxxxxxxx>
Date:   Tue Jul 25 12:16:41 2023 +0200

    tools: ynl-gen: fix enum index in _decode_enum(..)
    
    [ Upstream commit d7ddf5f4269fcaf19aafe971e635d91897423a3a ]
    
    Remove wrong index adjustment, which is leftover from adding
    support for sparse enums.
    enum.entries_by_val() function shall not subtract the start-value, as
    it is indexed with real enum value.
    
    Fixes: c311aaa74ca1 ("tools: ynl: fix enum-as-flags in the generic CLI")
    Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@xxxxxxxxx>
    Reviewed-by: Donald Hunter <donald.hunter@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230725101642.267248-2-arkadiusz.kubalewski@xxxxxxxxx
    Reviewed-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 3144f33196be4..35462c7ce48b5 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -405,8 +405,8 @@ class YnlFamily(SpecFamily):
     def _decode_enum(self, rsp, attr_spec):
         raw = rsp[attr_spec['name']]
         enum = self.consts[attr_spec['enum']]
-        i = attr_spec.get('value-start', 0)
         if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
+            i = 0
             value = set()
             while raw:
                 if raw & 1:
@@ -414,7 +414,7 @@ class YnlFamily(SpecFamily):
                 raw >>= 1
                 i += 1
         else:
-            value = enum.entries_by_val[raw - i].name
+            value = enum.entries_by_val[raw].name
         rsp[attr_spec['name']] = value
 
     def _decode_binary(self, attr, attr_spec):



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux