Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kfifo: fix kfifo_to_user() return type

The kfifo_to_user() macro is supposed to return zero for success or
negative error codes. Unfortunately, there is a signedness bug so it
returns unsigned int. This only affects callers which try to save the
result in ssize_t and as far as I can see the only place which does that
is line6_hwdep_read().

TL;DR: s/_uint/_int/.

Link: https://lkml.kernel.org/r/YrVL3OJVLlNhIMFs@kili
Fixes: 144ecf310eb5 ("kfifo: fix kfifo_alloc() to return a signed int value")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Stefani Seibold <stefani@seibold.net>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Dan Carpenter and committed by
akpm
045ed31e 43c249ea

+1 -1
+1 -1
include/linux/kfifo.h
··· 688 688 * writer, you don't need extra locking to use these macro. 689 689 */ 690 690 #define kfifo_to_user(fifo, to, len, copied) \ 691 - __kfifo_uint_must_check_helper( \ 691 + __kfifo_int_must_check_helper( \ 692 692 ({ \ 693 693 typeof((fifo) + 1) __tmp = (fifo); \ 694 694 void __user *__to = (to); \