Skip to contentSkip to conversation

s390/dis: Fix invalid array size

PATCH Applied Syam Sidhardhan 2 participants 2 messages Feb 24, 2013 – Feb 25, 2013 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/dis: Fix invalid array size

We are using sizeof operator for an array given as function argument, which is incorrect.

---
 arch/s390/kernel/dis.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/dis.c +2 -2
index c50665f..3ad5e95 100644
@@ -1711,10 +1711,10 @@ int insn_to_mnemonic(unsigned char *instruction, char buf[8])
 	if (!insn)
 		return -ENOENT;
 	if (insn->name[0] == '\0')
-		snprintf(buf, sizeof(buf), "%s",
+		snprintf(buf, 8, "%s",
 			 long_insn_name[(int) insn->name[1]]);
 	else
-		snprintf(buf, sizeof(buf), "%.5s", insn->name);
+		snprintf(buf, 8, "%.5s", insn->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(insn_to_mnemonic);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · Syam Sidhardhan

We are using sizeof operator for an array given as function argument, which is incorrect.

---
 arch/s390/kernel/dis.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/dis.c +0 -0
index c50665f..3ad5e95 100644

arch/s390/kernel/dis.c int insn_to_mnemonic(unsigned char *instruction, char buf[8]) · line 1715

Quoted 6 lines
arch/s390/kernel/dis.c +1 -1
@@ -1711,10 +1711,10 @@ int insn_to_mnemonic(unsigned char *instruction, char buf[8])
 	if (!insn)
 		return -ENOENT;
 	if (insn->name[0] == '\0')
-		snprintf(buf, sizeof(buf), "%s",
+		snprintf(buf, 8, "%s",
 			 long_insn_name[(int) insn->name[1]]);

Thanks, applied.