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

usb: gadget: rndis: use signed type for a signed value

rndis_get_nr() returns either a non-negative value on success
or a negative value on failure. In case of failure an error code
is returned to the caller of rndis_register().
If the "i" is unsigned, the information about error from rndis_get_nr()
is lost. If there is no error but rndis_get_nr() returns a value greater
than 256 the least significant bits of i are zero effectively limiting the
number of configs to 256.

This patch fixes that.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
81dff869 c0d96af2

+3 -3
+2 -2
drivers/usb/gadget/function/rndis.c
··· 872 872 struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) 873 873 { 874 874 struct rndis_params *params; 875 - u8 i; 875 + int i; 876 876 877 877 if (!resp_avail) 878 878 return ERR_PTR(-EINVAL); ··· 923 923 924 924 void rndis_deregister(struct rndis_params *params) 925 925 { 926 - u8 i; 926 + int i; 927 927 928 928 pr_debug("%s:\n", __func__); 929 929
+1 -1
drivers/usb/gadget/function/rndis.h
··· 177 177 178 178 typedef struct rndis_params 179 179 { 180 - u8 confignr; 180 + int confignr; 181 181 u8 used; 182 182 u16 saved_filter; 183 183 enum rndis_state state;