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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
--
2.33.0






[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux