diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-06-25 09:35:18 +0200 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2018-06-25 10:34:31 +0200 |
commit | 3391ca1dcd70a8e958984f7e95f242d36f0b9ab8 (patch) | |
tree | 46f126bb63af361216187d7b8540a7037adce9ce /drivers/usb/serial/ir-usb.c | |
parent | Linux 4.18-rc2 (diff) | |
download | linux-3391ca1dcd70a8e958984f7e95f242d36f0b9ab8.tar.xz linux-3391ca1dcd70a8e958984f7e95f242d36f0b9ab8.zip |
USB: serial: cast sizeof() to int when comparing with error code
Negative error code will be larger than sizeof().
Note that none of these bugs prevent errors from being detected, even if
the ir-usb one would cause a less precise debug message to printed.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
[ johan: add comment about implications ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/ir-usb.c')
-rw-r--r-- | drivers/usb/serial/ir-usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 24b06c7e5e2d..7643716b5299 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -132,7 +132,7 @@ irda_usb_find_class_desc(struct usb_serial *serial, unsigned int ifnum) 0, ifnum, desc, sizeof(*desc), 1000); dev_dbg(&serial->dev->dev, "%s - ret=%d\n", __func__, ret); - if (ret < sizeof(*desc)) { + if (ret < (int)sizeof(*desc)) { dev_dbg(&serial->dev->dev, "%s - class descriptor read %s (%d)\n", __func__, (ret < 0) ? "failed" : "too short", ret); |