mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
UPSTREAM: proc: avoid integer type confusion in get_proc_long
commit e6cfaf34be 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.
Bug: 261488859
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>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Icb7df4e5d9061d8a2c854b3f7cccaa753d6ea540
Signed-off-by: Lee Jones <joneslee@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
62445f069c
commit
82c8448b4e
@@ -472,13 +472,12 @@ static int proc_get_long(char **buf, size_t *size,
|
||||
unsigned long *val, bool *neg,
|
||||
const char *perm_tr, unsigned perm_tr_len, char *tr)
|
||||
{
|
||||
int len;
|
||||
char *p, tmp[TMPBUFLEN];
|
||||
ssize_t len = *size;
|
||||
|
||||
if (!*size)
|
||||
if (len <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
len = *size;
|
||||
if (len > TMPBUFLEN - 1)
|
||||
len = TMPBUFLEN - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user