Skip to contentSkip to conversation

lkdtm: remove unnecessary terminated-null assign

PATCH New Chen Zhou 1 participant 1 message Jan 19, 2020

Subsystems (2)
lore
Share & tools
lore

Chen Zhou

author
#0 lore raw

PATCH 1/1 lkdtm: remove unnecessary terminated-null assign

scnprintf implementation of kernel guarantees that its result is terminated with null byte if size is larger than 0. So we don't need to set terminated-null again.

---
 drivers/misc/lkdtm/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/misc/lkdtm/core.c +0 -1
index ee0d6e7..5ad2630 100644
@@ -341,7 +341,6 @@ static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf,
 		n += scnprintf(buf + n, PAGE_SIZE - n, "%s\n",
 			      crashtypes[i].name);
 	}
-	buf[n] = '\0';
 
 	out = simple_read_from_buffer(user_buf, count, off,
 				      buf, n);
Signature · 1 line
2.7.4