Skip to contentSkip to conversation

platform/x86: huawei-wmi: Fix a precision vs width printf bug

PATCH New Dan Carpenter 1 participant 1 message Oct 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: huawei-wmi: Fix a precision vs width printf bug

This was supposed to be precision "%.*s" instead of width "%*s". It's possible that this results in printing beyond the end of the string.

Fixes a970b95345ab ("platform/x86: huawei-wmi: Add debugfs support")
---
 drivers/platform/x86/huawei-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/huawei-wmi.c +1 -1
index 6720f78c60c2..69a7be8dafcd 100644
@@ -612,7 +612,7 @@ static void huawei_wmi_debugfs_call_dump(struct seq_file *m, void *data,
 		seq_printf(m, "0x%llx", obj->integer.value);
 		break;
 	case ACPI_TYPE_STRING:
-		seq_printf(m, "\"%*s\"", obj->string.length, obj->string.pointer);
+		seq_printf(m, "\"%.*s\"", obj->string.length, obj->string.pointer);
 		break;
 	case ACPI_TYPE_BUFFER:
 		seq_puts(m, "{");
Signature · 1 line
2.20.1