summaryrefslogtreecommitdiff
path: root/drivers/iommu/iommu-debug.c
diff options
context:
space:
mode:
authorVijayanand Jitta <vjitta@codeaurora.org>2019-02-13 14:21:41 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-02-14 22:55:25 -0800
commitf734ed8448d9ca8f18e613d83ebc79d9433e6206 (patch)
treed69ec1a9fc43ffefabea65a9c9cc1ec43dbc85c4 /drivers/iommu/iommu-debug.c
parentf7a9286e8f8fe5c6733352217dfe18b87e010531 (diff)
iommu: iommu-debug: don't pass null character to copy_to_user
Doing a cat on pte,test_virt_addr from adb shell prints a null character as well which is at the end of the string this is not required so, don't pass this null character to copy_to_user. Change-Id: I8d9120f64d1df84a704379eb00bd239fc7059e9e Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
Diffstat (limited to 'drivers/iommu/iommu-debug.c')
-rw-r--r--drivers/iommu/iommu-debug.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c
index a5a749183242..108976f795b5 100644
--- a/drivers/iommu/iommu-debug.c
+++ b/drivers/iommu/iommu-debug.c
@@ -1403,7 +1403,7 @@ static ssize_t iommu_debug_virt_addr_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "0x%pK\n", virt_addr);
- buflen = min(count, strlen(buf)+1);
+ buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
@@ -1527,7 +1527,7 @@ static ssize_t iommu_debug_pte_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "pte=%016llx\n", pte);
- buflen = min(count, strlen(buf)+1);
+ buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
@@ -1596,7 +1596,7 @@ static ssize_t iommu_debug_atos_read(struct file *file, char __user *ubuf,
snprintf(buf, 100, "%pa\n", &phys);
}
- buflen = min(count, strlen(buf)+1);
+ buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
@@ -1649,7 +1649,7 @@ static ssize_t iommu_debug_dma_atos_read(struct file *file, char __user *ubuf,
else
snprintf(buf, 100, "%pa\n", &phys);
- buflen = min(count, strlen(buf)+1);
+ buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;
@@ -1880,7 +1880,7 @@ static ssize_t iommu_debug_dma_map_read(struct file *file, char __user *ubuf,
iova = ddev->iova;
snprintf(buf, 100, "%pa\n", &iova);
- buflen = min(count, strlen(buf)+1);
+ buflen = min(count, strlen(buf));
if (copy_to_user(ubuf, buf, buflen)) {
pr_err("Couldn't copy_to_user\n");
retval = -EFAULT;