android_kernel_motorola_sm6225/samples
Dan Carpenter 5350ad4401 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-22 10:59:38 +02:00
..
auxdisplay
bpf samples: bpf: Fix lwt_len_hist reusing previous BPF map 2020-12-30 11:25:57 +01:00
configfs
connector
hidraw
hw_breakpoint
kdb
kfifo kfifo: fix ternary sign extension bugs 2021-05-22 10:59:38 +02:00
kobject
kprobes
livepatch
mei mei: samples: fix a signedness bug in amt_host_if_call() 2019-11-24 08:19:50 +01:00
mic/mpssd misc: vop: add round_up(x,4) for vring_size to avoid kernel panic 2020-10-30 10:38:29 +01:00
pktgen samples: pktgen: fix proc_cmd command result check logic 2019-12-31 16:34:59 +01:00
qmi
rpmsg
seccomp
statx
timers
trace_events
trace_printk
uhid
v4l
vfio-mdev vmalloc: fix remap_vmalloc_range() bounds checks 2020-04-29 16:31:27 +02:00
watchdog
Kconfig
Makefile