Skip to contentSkip to conversation

trace: code optimization

PATCH In review liuyang34 3 participants 3 messages Jan 9, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

liuyang34

author
#1 lore raw

PATCH 1/1 trace: code optimization

use scnprintf instead of snprinr and no need to check the return size again

---
 kernel/trace/trace_stack.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/trace/trace_stack.c +1 -3
index c557f42..7b15e9a 100644
@@ -329,9 +329,7 @@ stack_max_size_read(struct file *filp, char __user *ubuf,
 	char buf[64];
 	int r;
 
-	r = snprintf(buf, sizeof(buf), "%ld\n", *ptr);
-	if (r > sizeof(buf))
-		r = sizeof(buf);
+	r = scnprintf(buf, sizeof(buf), "%ld\n", *ptr);
 	return simple_read_from_buffer(ubuf, count, ppos, buf, r);
 }
 
Signature · 1 line
2.7.4
maintainer
#3 lore raw
Quoted 11 lines · On Thu, 9 Jan 2020 14:16:46 +0100 Markus Elfring <[email protected]> wrote:
Quoted 1 line

use scnprintf instead of snprinr and no need to check

Will a typo be avoided in the final change description?

Quoted 1 line
Signed-off-by liuyang34 …

Will this information need also an adjustment for the desired specification of a real name?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id°7f636fca1c8fbba124b0082487c0b3890a0e0c#n458

Correct. Please resend the patch with the typo fix and a real name for the Signed-off-by.

Thanks!

-- Steve