ftrace: '< 0' test on unsigned
PATCH 1/1 ftrace: '< 0' test on unsigned
or should this be fixed, with
if (!cnt || cnt > DEFINE)
if so, what should DEFINE be?
This patch wasn't tested in any way. ------------------------------>8-------------8<--------------------------------- cnt is unsigned, so the '< 0' test won't work.
---
kernel/trace/ftrace.c +1 -1
@@ -1129,7 +1129,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,size_t read =0 ;ssize_t ret; -if (!cnt || cnt <0 ) +if (!cnt || (ssize_t )cnt <0 )return 0 ;mutex_lock (&ftrace_regex_lock);
Steven Rostedt
maintainerQuoted 5 lines · Roel Kluin
or should this be fixed, with
if (!cnt || cnt > DEFINE)if so, what should DEFINE be?
Hi Roel,
Thanks, but I already put in the fix for this. Since Andrew pointed out that cnt was unsigned in my "cut and paste" from this function. I went back and fixed it. There should be no DEFINE. cnt can never be less than zero, so simply checking for (!cnt) is sufficient.
-- Steve
Quoted 22 lines
This patch wasn't tested in any way. ------------------------------>8-------------8<--------------------------------- cnt is unsigned, so the '< 0' test won't work.
Signed-off-by Roel Kluin <[email protected]>---
kernel/trace/ftrace.c +1
-1@@ -1129,7 +1129,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,size_t read =0 ;ssize_t ret; -if (!cnt || cnt <0 ) +if (!cnt || (ssize_t )cnt <0 )return 0 ;mutex_lock (&ftrace_regex_lock);