diff mbox series

[RFC,v1,17/30] platform/x86: wmi: use sizeof() instead of hard-coding

Message ID 20210904175450.156801-18-pobrn@protonmail.com (mailing list archive)
State Rejected, archived
Headers show
Series platform/x86: wmi: minor improvements | expand

Commit Message

Barnabás Pőcze Sept. 4, 2021, 5:55 p.m. UTC
Avoid hard-coding the buffer size in an `snprintf()`
call by using `sizeof()` to retrieve the size.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.33.0
diff mbox series

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index f05c89fd1f79..979135a678e0 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -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)