[PATCH 2/7] Use a small buffer instead of a full page for sysfs boolean output

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

 



reader_mode_show is now called also from within the driver, on a buffer 
allocated on the stack, so make sure it only uses a small buffer.

Signed-off-by: Matan Ziv-Av <matan@xxxxxxxxxxx>
---
 drivers/platform/x86/lg-laptop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index 78d3e3d2e51a..ab79457d5ffe 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -28,6 +28,8 @@ MODULE_DESCRIPTION("LG WMI Hotkey Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("1.1");
 
+#define BUFFER_SIZE 16
+
 #define WMI_EVENT_GUID0	"E4FB94F9-7F2B-4173-AD1A-CD1D95086248"
 #define WMI_EVENT_GUID1	"023B133E-49D1-4E10-B313-698220140DC2"
 #define WMI_EVENT_GUID2	"37BE1AC0-C3F2-4B1F-BFBE-8FDEAF2814D6"
@@ -406,7 +408,7 @@ static ssize_t reader_mode_show(struct device *dev,
 
 	kfree(r);
 
-	return snprintf(buffer, PAGE_SIZE, "%d\n", status);
+	return snprintf(buffer, BUFFER_SIZE, "%d\n", status);
 }
 
 static ssize_t fn_lock_store(struct device *dev,
-- 
2.21.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