Blame SOURCES/0001-Fix-memory-type-detail-map-size.patch

79f74b
From 4e29e6d5687cf25ac16e48ad41498526e6a56ca8 Mon Sep 17 00:00:00 2001
79f74b
From: Lianbo Jiang <lijiang@redhat.com>
79f74b
Date: Sun, 28 Apr 2019 14:06:59 +0800
79f74b
Subject: [PATCH] Fix memory type detail map size
79f74b
79f74b
Note: (https://github.com/nima/python-dmidecode/pull/5/commits/
79f74b
edca64c89d084a8c42b9c48a51eb5ac13eac52c6)
79f74b
79f74b
For index and array size in xml map, bit mapped type descriptions
79f74b
array size must be kept coerent with bit mask otherwise it could
79f74b
cause an error, e.g:
79f74b
79f74b
Python 3.6.8 (default, Apr  3 2019, 12:10:30)
79f74b
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
79f74b
Type "help", "copyright", "credits" or "license" for more information.
79f74b
>>> import dmidecode
79f74b
>>> dmidecode.memory()
79f74b
IndexError: list assignment index out of range
79f74b
79f74b
The above exception was the direct cause of the following exception:
79f74b
79f74b
Traceback (most recent call last):
79f74b
  File "<stdin>", line 1, in <module>
79f74b
SystemError: <built-in function memory> returned a result with an error set
79f74b
79f74b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
79f74b
---
79f74b
 src/dmidecode.c | 4 ++--
79f74b
 src/pymap.xml   | 2 +-
79f74b
 2 files changed, 3 insertions(+), 3 deletions(-)
79f74b
79f74b
diff --git a/src/dmidecode.c b/src/dmidecode.c
79f74b
index 0615bad315fb..d74a374a3a0f 100644
79f74b
--- a/src/dmidecode.c
79f74b
+++ b/src/dmidecode.c
79f74b
@@ -2905,9 +2905,9 @@ void dmi_memory_device_type_detail(xmlNode *node, u16 code)
79f74b
         dmixml_AddAttribute(data_n, "dmispec", "7.18.3");
79f74b
         dmixml_AddAttribute(data_n, "flags", "0x%04x", code);
79f74b
 
79f74b
-        if((code & 0x1FFE) != 0) {
79f74b
+        if((code & 0xFFFE) != 0) {
79f74b
                 int i;
79f74b
-                for(i = 1; i <= 14; i++) {
79f74b
+                for(i = 1; i <= 15; i++) {
79f74b
                         if(code & (1 << i)) {
79f74b
                                 xmlNode *td_n = dmixml_AddTextChild(data_n, "flag", "%s", detail[i - 1]);
79f74b
                                 assert( td_n != NULL );
79f74b
diff --git a/src/pymap.xml b/src/pymap.xml
79f74b
index 7d5de70bda65..7325a8527018 100644
79f74b
--- a/src/pymap.xml
79f74b
+++ b/src/pymap.xml
79f74b
@@ -440,7 +440,7 @@
79f74b
               valuetype="string" value="concat(TotalWidth, ' ', TotalWidth/@unit)"/>
79f74b
           <Map keytype="constant" key="AssetTag" valuetype="string" value="AssetTag"/>
79f74b
           
79f74b
-              fixedsize="12" index_attr="index"/>
79f74b
+              fixedsize="15" index_attr="index"/>
79f74b
           <Map keytype="constant" key="Array Handle" valuetype="string" value="@ArrayHandle"/>
79f74b
           <Map keytype="constant" key="Form Factor" valuetype="string" value="FormFactor"/>
79f74b
           
79f74b
-- 
79f74b
2.17.1
79f74b