Skip to content

Commit a8cc8fa

Browse files
atenartPaolo Abeni
authored andcommitted
net: sysctl: do not reserve an extra char in dump_cpumask temporary buffer
When computing the length we'll be able to use out of the buffers, one char is removed from the temporary one to make room for a newline. It should be removed from the output buffer length too, but in reality this is not needed as the later call to scnprintf makes sure a null char is written at the end of the buffer which we override with the newline. Signed-off-by: Antoine Tenart <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent d631094 commit a8cc8fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/sysctl_net_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void dump_cpumask(void *buffer, size_t *lenp, loff_t *ppos,
6262
return;
6363
}
6464

65-
len = min(sizeof(kbuf) - 1, *lenp);
65+
len = min(sizeof(kbuf), *lenp);
6666
len = scnprintf(kbuf, len, "%*pb", cpumask_pr_args(mask));
6767
if (!len) {
6868
*lenp = 0;

0 commit comments

Comments
 (0)