lkml.org 
[lkml]   [2012]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mmc: debugfs: Fix incorrect size of string allocation
Date
It is usually accepted that code should explain itself.
The max size of string is 1025(512*2 + 1) bytes so there is
no point to add one more byte for string allocation.

This patch is intended to fix incorrect size for string allocation
and make code more readable.

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>
---
drivers/mmc/core/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 35c2f85..5008149 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -281,7 +281,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp)
u8 *ext_csd;
int err, i;

- buf = kmalloc(EXT_CSD_STR_LEN + 1, GFP_KERNEL);
+ buf = kmalloc(EXT_CSD_STR_LEN, GFP_KERNEL);
if (!buf)
return -ENOMEM;

--
1.8.0


\
 
 \ /
  Last update: 2012-12-04 10:02    [W:0.056 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site