]> 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)
committerJuergen Gross <jgross@suse.com>
Fri, 12 Aug 2022 10:16:39 +0000 (12:16 +0200)
commit3ff1472665fe5a8ad646079f1e5a58566bd5499b
treeb59e8fa5103d0a3f6c4a98b17ff1458f91e2614f
parent1dd095572b1b7d7e10f43abdba1e1748bef5510a
xen/xenbus: fix return type in xenbus_file_read()

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: 9af758bed9bd ("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>
drivers/xen/xenbus/xenbus_dev_frontend.c