Skip to content

Commit 39a37ce

Browse files
error27joergroedel
authored andcommitted
dma-debug: Cleanup for copy-loop in filter_write()
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@gmail.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent 12ff4bf commit 39a37ce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎lib/dma-debug.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
570570
* Now parse out the first token and use it as the name for the
571571
* driver to filter for.
572572
*/
573-
for (i = 0; i < NAME_MAX_LEN; ++i) {
573+
for (i = 0; i < NAME_MAX_LEN - 1; ++i) {
574574
current_driver_name[i] = buf[i];
575575
if (isspace(buf[i]) || buf[i] == ' ' || buf[i] == 0)
576576
break;

0 commit comments

Comments
 (0)