]> git.baikalelectronics.ru Git - kernel.git/commit
xen/xenbus: fix return type in xenbus_file_read()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 Aug 2022 07:11:33 +0000 (10:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:26 +0000 (11:18 +0200)
commit7bd90bb2345e42bd80016018cf53570606d5c22e
tree0e9b881c6fc16e2ff1db4d4ed40d972bc0188ca8
parent34abd30a80f16fe5052453831376b081b8a6f22e
xen/xenbus: fix return type in xenbus_file_read()

commit ba9684361a325cca1ed06d9c9bd083b9f7a53da2 upstream.

This code tries to store -EFAULT in an unsigned int.  The
xenbus_file_read() function returns type ssize_t so the negative value
is returned as a positive value to the user.

This change forces another change to the min() macro.  Originally, the
min() macro used "unsigned" type which checkpatch complains about.  Also
unsigned type would break if "len" were not capped at MAX_RW_COUNT.  Use
size_t for the min().  (No effect on runtime for the min_t() change).

Fixes: 0ecdbb82c3d2 ("xen: Add xenbus device driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Link: https://lore.kernel.org/r/YutxJUaUYRG/VLVc@kili
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/xenbus/xenbus_dev_frontend.c