linux/samples
Dan Carpenter 926ee00ea2 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: 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>
2021-04-30 11:20:35 -07:00
..
acrn sample/acrn: Introduce a sample of HSM ioctl interface usage 2021-02-09 10:58:19 +01:00
auxdisplay treewide: Miguel has moved 2021-02-26 09:41:03 -08:00
binderfs
bpf samples/bpf: Fix broken tracex1 due to kprobe argument change 2021-04-19 18:19:49 -07:00
configfs
connector
ftrace
hidraw
hw_breakpoint
kdb
kfifo kfifo: fix ternary sign extension bugs 2021-04-30 11:20:35 -07:00
kmemleak
kobject
kprobes samples/kprobes: Add ARM support 2021-01-18 13:24:18 -07:00
livepatch
mei
nitro_enclaves
pidfd
pktgen samples: pktgen: new append mode 2021-03-14 14:22:38 -07:00
qmi
rpmsg
seccomp
timers
trace_events
trace_printk
uhid
v4l
vfio-mdev vfio/mdev: Correct the function signatures for the mdev_type_attributes 2021-04-12 10:36:00 -06:00
vfs
watch_queue watch_queue: Drop references to /dev/watch_queue 2021-01-21 16:16:08 +00:00
watchdog
Kconfig watch_queue: Drop references to /dev/watch_queue 2021-01-21 16:16:08 +00:00
Makefile