Skip to content

Commit

Permalink
sysctl: don't print negative flag for proc_douintvec
Browse files Browse the repository at this point in the history
I saw some very confusing sysctl output on my system:
  # cat /proc/sys/net/core/xfrm_aevent_rseqth
  -2
  # cat /proc/sys/net/core/xfrm_aevent_etime
  -10
  # cat /proc/sys/net/ipv4/tcp_notsent_lowat
  -4294967295

Because we forget to set the *negp flag in proc_douintvec, so it will
become a garbage value.

Since the value related to proc_douintvec is always an unsigned integer,
so we can set *negp to false explictily to fix this issue.

Fixes: e7d316a ("sysctl: handle error writing UINT_MAX to u32 fields")
Signed-off-by: Liping Zhang <[email protected]>
Cc: Subash Abhinov Kasiviswanathan <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Liping Zhang authored and torvalds committed Apr 7, 2017
1 parent 1680a38 commit 5380e56
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,7 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
*valp = *lvalp;
} else {
unsigned int val = *valp;
*negp = false;
*lvalp = (unsigned long)val;
}
return 0;
Expand Down

0 comments on commit 5380e56

Please sign in to comment.