lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1354608912-544-1-git-send-email-kyungsik.lee@lge.com>
Date:	Tue,  4 Dec 2012 17:15:12 +0900
From:	Kyungsik Lee <kyungsik.lee@....com>
To:	Chris Ball <cjb@...top.org>
Cc:	Adrian Hunter <adrian.hunter@...el.com>,
	Philip Rakity <prakity@...dia.com>,
	Felipe Balbi <balbi@...com>, raphael.andy.lee@...il.com,
	linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
	Kyungsik Lee <kyungsik.lee@....com>
Subject: [PATCH] mmc: debugfs: Fix incorrect size of string allocation

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@....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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ