net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 Nov 2019 18:28:31 +0000 (21:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:19:10 +0000 (08:19 +0100)
commit4c62337d8f1727f5005e41a141fe42c0154c21f9
treefe9ad914031a0cb6d52781d92d02961501768550
parent17a82bc67728e788d0f8fbe80db6645e463b2037
net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size()

commit a56dcc6b455830776899ce3686735f1172e12243 upstream.

This code is supposed to test for negative error codes and partial
reads, but because sizeof() is size_t (unsigned) type then negative
error codes are type promoted to high positive values and the condition
doesn't work as expected.

Fixes: 332f989a3b00 ("CDC-NCM: handle incomplete transfer of MTU")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/cdc_ncm.c