From fd6f0a5f291b4aa5c7c3f8aa97e3f49542eceea0 Mon Sep 17 00:00:00 2001 From: Jerry Hoemann Date: Sat, 18 Jun 2022 11:10:53 +0200 Subject: dmioem: Incorrect use of static The *str = "Reserved" is intended as the default value when index is outside of the array. str shouldn't retain values from an earlier invocation of the function. Signed-off-by: Jerry Hoemann Fixes: 3e86b5d3a228 ("dmioem: Decode HPE OEM Record 203") Fixes: 4d8bdbc8b287 ("dmioem: Decode HPE OEM Record 238") Signed-off-by: Jean Delvare --- dmioem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dmioem.c') diff --git a/dmioem.c b/dmioem.c index 1b4fcd8..c26fff9 100644 --- a/dmioem.c +++ b/dmioem.c @@ -243,7 +243,7 @@ static void dmi_hp_203_bayenc(const char *fname, u8 num) static void dmi_hp_203_devtyp(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *type[] = { "Unknown", /* 0x00 */ "Reserved", @@ -273,7 +273,7 @@ static void dmi_hp_203_devtyp(const char *fname, unsigned int code) static void dmi_hp_203_devloc(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *location[] = { "Unknown", /* 0x00 */ "Embedded", @@ -301,7 +301,7 @@ static void dmi_hp_203_devloc(const char *fname, unsigned int code) static void dmi_hp_238_loc(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *location[] = { "Internal", /* 0x00 */ "Front of Server", @@ -321,7 +321,7 @@ static void dmi_hp_238_loc(const char *fname, unsigned int code) static void dmi_hp_238_flags(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *flags[] = { "Not Shared", /* 0x00 */ "Shared with physical switch", @@ -336,7 +336,7 @@ static void dmi_hp_238_flags(const char *fname, unsigned int code) static void dmi_hp_238_speed(const char *fname, unsigned int code) { - static const char *str = "Reserved"; + const char *str = "Reserved"; static const char *speed[] = { "Reserved", /* 0x00 */ "USB 1.1 Full Speed", -- cgit v1.2.1