kernel_optimize_test/samples
Dan Carpenter 618fa6a35c kfifo: fix ternary sign extension bugs
[ Upstream commit 926ee00ea24320052b46745ef4b00d91c05bd03d ]

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: 5bf2b19320 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-14 09:50:45 +02:00
..
auxdisplay
binderfs
bpf samples, bpf: Add missing munmap in xdpsock 2021-03-17 17:06:12 +01:00
configfs
connector
ftrace samples/ftrace: Mark my_tramp[12]? global 2020-11-30 21:42:48 -05:00
hidraw
hw_breakpoint
kdb
kfifo kfifo: fix ternary sign extension bugs 2021-05-14 09:50:45 +02:00
kmemleak
kobject
kprobes
livepatch
mei
nitro_enclaves
pidfd
pktgen
qmi
rpmsg
seccomp
timers
trace_events
trace_printk
uhid
v4l
vfio-mdev
vfs
watch_queue watch_queue: Drop references to /dev/watch_queue 2021-03-04 11:37:59 +01:00
watchdog
Kconfig watch_queue: Drop references to /dev/watch_queue 2021-03-04 11:37:59 +01:00
Makefile