mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] lkdtm: remove unnecessary terminated-null assign
@ 2020-01-19 12:36 Chen Zhou
  0 siblings, 0 replies; only message in thread
From: Chen Zhou @ 2020-01-19 12:36 UTC (permalink / raw)
  To: keescook, arnd, gregkh; +Cc: linux-kernel, chenzhou10

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.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
 drivers/misc/lkdtm/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
index ee0d6e7..5ad2630 100644
--- a/drivers/misc/lkdtm/core.c
+++ b/drivers/misc/lkdtm/core.c
@@ -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);
-- 
2.7.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-19 12:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 12:36 [PATCH -next] lkdtm: remove unnecessary terminated-null assign Chen Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®