summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXia Yang <xiay@nvidia.com>2016-08-15 14:56:51 -0700
committerWinnie Hsu <whsu@nvidia.com>2016-10-26 15:41:05 -0700
commit023d6603c588e3e592a2750bf6eff16212bbe9f7 (patch)
tree4bc1e01deee72379bdb687e943bb517e4071afc8 /drivers
parentd0d666fcd21dea1424006c34fd158067ced90ce2 (diff)
mmc: card: test: Fix out of boundary array access
Allocate buffer with 1 extra byte for NULL terminator. Bug 1791602 Change-Id: I3c3658315c2cd2a1dc7be7d72953998a5275e71e Signed-off-by: Xia Yang <xiay@nvidia.com> Reviewed-on: http://git-master/r/1216897 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/card/mmc_test.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 69f549d17a53..784e5b4dc46d 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -3021,7 +3021,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
char *data_buf = NULL;
long testcase;
- data_buf = kzalloc(count, GFP_KERNEL);
+ data_buf = kzalloc(count+1, GFP_KERNEL);
if (data_buf == NULL)
return -ENOMEM;
@@ -3029,7 +3029,6 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
kfree(data_buf);
return -EFAULT;
}
- data_buf[strlen(data_buf) - 1] = '\0';
if (mmc_test_extract_parameters(data_buf)) {
mmc_test_usage(sf);
return -EFAULT;