staging: ks7010: change length type to unsigned
authorTobin C. Harding <me@tobin.cc>
Mon, 10 Apr 2017 03:15:40 +0000 (13:15 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Apr 2017 14:03:36 +0000 (16:03 +0200)
Length undergoes type conversion when passed (indirectly) as an
argument for parameter of type 'unsigned int'. If length is negative
this is a bug (the value after conversion is large).

Declare 'length' to be an unsigned type instead of a signed type.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ks7010/ks7010_sdio.c

index 3403edd..b93c9a4 100644 (file)
@@ -712,7 +712,7 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card)
        unsigned char *rom_buf;
        unsigned char rw_data = 0;
        int ret;
-       int length;
+       unsigned int length;
        const struct firmware *fw_entry = NULL;
 
        /* buffer allocate */