]> git.baikalelectronics.ru Git - kernel.git/commit
proc: avoid integer type confusion in get_proc_long
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 5 Dec 2022 19:33:40 +0000 (11:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:23:06 +0000 (11:23 +0100)
commitb1002c7d37e3f09b47fb0fd32a4eb7409036079c
tree3d2b5bc01c89257fbdd7a42ab443740736a28270
parentb92ae45983d73d5bbddbc3c04ee5e5693b64ccc0
proc: avoid integer type confusion in get_proc_long

commit e6cfaf34be9fcd1a8285a294e18986bfc41a409c upstream.

proc_get_long() is passed a size_t, but then assigns it to an 'int'
variable for the length.  Let's not do that, even if our IO paths are
limited to MAX_RW_COUNT (exactly because of these kinds of type errors).

So do the proper test in the rigth type.

Reported-by: Kyle Zeng <zengyhkyle@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sysctl.c