diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 188c305aeb8b..8898ddeaaf75 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -342,13 +342,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;