[linux-yocto] [PATCH 1/5] drivers/misc: Update Memory Allocation in axxia-oem.c

Daniel Dragomir daniel.dragomir at windriver.com
Tue May 14 06:23:55 PDT 2019


From: John Jacques <john.jacques at intel.com>

Memory allocation in axxia-oem.c was not allocating a byte
for the termination character.

Signed-off-by: John Jacques <john.jacques at intel.com>
---
 drivers/misc/axxia-oem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/axxia-oem.c b/drivers/misc/axxia-oem.c
index 0599242..e46ee71 100644
--- a/drivers/misc/axxia-oem.c
+++ b/drivers/misc/axxia-oem.c
@@ -92,7 +92,7 @@ axxia_dspc_write(struct file *file, const char __user *buffer,
 	char *input;
 	unsigned long mask;
 
-	input = kmalloc(count, __GFP_WAIT);
+	input = kmalloc(count + 1, __GFP_WAIT);
 
 	if (NULL == input)
 		return -ENOSPC;
@@ -146,7 +146,7 @@ axxia_actlr_el3_write(struct file *file, const char __user *buffer,
 {
 	char *input;
 
-	input = kmalloc(count, __GFP_WAIT);
+	input = kmalloc(count + 1, __GFP_WAIT);
 
 	if (NULL == input)
 		return -ENOSPC;
@@ -199,7 +199,7 @@ axxia_actlr_el2_write(struct file *file, const char __user *buffer,
 {
 	char *input;
 
-	input = kmalloc(count, __GFP_WAIT);
+	input = kmalloc(count + 1, __GFP_WAIT);
 
 	if (NULL == input)
 		return -ENOSPC;
@@ -255,7 +255,7 @@ axxia_ccn_offset_write(struct file *file, const char __user *buffer,
 	char *input;
 	unsigned int new_ccn_offset;
 
-	input = kmalloc(count, __GFP_WAIT);
+	input = kmalloc(count + 1, __GFP_WAIT);
 
 	if (NULL == input)
 		return -ENOSPC;
@@ -316,7 +316,7 @@ axxia_ccn_value_write(struct file *file, const char __user *buffer,
 {
 	char *input;
 
-	input = kmalloc(count, __GFP_WAIT);
+	input = kmalloc(count + 1, __GFP_WAIT);
 
 	if (NULL == input)
 		return -ENOSPC;
-- 
2.7.4



More information about the linux-yocto mailing list