summaryrefslogtreecommitdiff
path: root/samples/trace_events
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-04-30 08:54:15 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-04-30 21:20:35 +0300
commit926ee00ea24320052b46745ef4b00d91c05bd03d (patch)
treee307a013836cf34e6ed669eaab2b839bbe288d05 /samples/trace_events
parentccf33ec4a7326066b544cdc6c6628a89a658dec8 (diff)
downloadlinux-926ee00ea24320052b46745ef4b00d91c05bd03d.tar.xz
kfifo: fix ternary sign extension bugs
The intent with this code was to return negative error codes but instead it returns positives. The problem is how type promotion works with ternary operations. These functions return long, "ret" is an int and "copied" is a u32. The negative error code is first cast to u32 so it becomes a high positive and then cast to long where it's still a positive. We could fix this by declaring "ret" as a ssize_t but let's just get rid of the ternaries instead. Link: https://lkml.kernel.org/r/YIE+/cK1tBzSuQPU@mwanda Fixes: 5bf2b19320ec ("kfifo: add example files to the kernel sample directory") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Stefani Seibold <stefani@seibold.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'samples/trace_events')
0 files changed, 0 insertions, 0 deletions