[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1270644409-10123-12-git-send-email-joerg.roedel@amd.com>
Date: Wed, 7 Apr 2010 14:46:48 +0200
From: Joerg Roedel <joerg.roedel@....com>
To: Ingo Molnar <mingo@...hat.com>
CC: x86@...nel.org, iommu@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, Dan Carpenter <error27@...il.com>,
Joerg Roedel <joerg.roedel@....com>
Subject: [PATCH 11/12] dma-debug: Cleanup for copy-loop in filter_write()
From: Dan Carpenter <error27@...il.com>
Earlier in this function we set the last byte of "buf" to NULL so we
always hit the break statement and "i" is never equal to NAME_MAX_LEN.
This patch doesn't change how the driver works but it silences a Smatch
warning and it makes it clearer that we don't write past the end of the
array.
Signed-off-by: Dan Carpenter <error27@...il.com>
Signed-off-by: Joerg Roedel <joerg.roedel@....com>
---
lib/dma-debug.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index ba8b670..01e6427 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -570,7 +570,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
* Now parse out the first token and use it as the name for the
* driver to filter for.
*/
- for (i = 0; i < NAME_MAX_LEN; ++i) {
+ for (i = 0; i < NAME_MAX_LEN - 1; ++i) {
current_driver_name[i] = buf[i];
if (isspace(buf[i]) || buf[i] == ' ' || buf[i] == 0)
break;
--
1.7.0.4
--
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