Skip to contentSkip to conversation

platform/x86: wmi: use sizeof() instead of hard-coding

RFC PATCH In review Barnabás Pőcze 1 participant 1 message Sep 4, 2021 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

RFC PATCH 17/30 platform/x86: wmi: use sizeof() instead of hard-coding

Avoid hard-coding the buffer size in an snprintf() call by using sizeof() to retrieve the size.

---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/wmi.c +1 -1
index f05c89fd1f79..979135a678e0 100644
@@ -189,7 +189,7 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable)
 	block = &wblock->gblock;
 	handle = wblock->acpi_device->handle;
 
-	snprintf(method, 5, "WE%02X", block->notify_id);
+	snprintf(method, sizeof(method), "WE%02X", block->notify_id);
 	status = acpi_execute_simple_method(handle, method, enable);
 
 	if (status != AE_OK && status != AE_NOT_FOUND)

--
2.33.0