Skip to content

Commit

Permalink
usb: gadget: rndis: use signed type for a signed value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Pietrasiewicz authored and Felipe Balbi committed May 21, 2015
1 parent c0d96af commit 81dff86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/function/rndis.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ static inline void rndis_put_nr(int nr)
struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)
{
struct rndis_params *params;
u8 i;
int i;

if (!resp_avail)
return ERR_PTR(-EINVAL);
Expand Down Expand Up @@ -923,7 +923,7 @@ EXPORT_SYMBOL_GPL(rndis_register);

void rndis_deregister(struct rndis_params *params)
{
u8 i;
int i;

pr_debug("%s:\n", __func__);

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/rndis.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ typedef struct rndis_resp_t

typedef struct rndis_params
{
u8 confignr;
int confignr;
u8 used;
u16 saved_filter;
enum rndis_state state;
Expand Down

0 comments on commit 81dff86

Please sign in to comment.