diff options
Diffstat (limited to 'drivers/staging/usbip/stub_main.c')
-rw-r--r-- | drivers/staging/usbip/stub_main.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c index c665d7f1ca9a..05e4c6064390 100644 --- a/drivers/staging/usbip/stub_main.c +++ b/drivers/staging/usbip/stub_main.c @@ -40,11 +40,12 @@ struct kmem_cache *stub_priv_cache; * remote host. */ #define MAX_BUSID 16 -static char busid_table[MAX_BUSID][BUS_ID_SIZE]; +#define BUSID_SIZE 20 +static char busid_table[MAX_BUSID][BUSID_SIZE]; static spinlock_t busid_table_lock; -int match_busid(char *busid) +int match_busid(const char *busid) { int i; @@ -52,7 +53,7 @@ int match_busid(char *busid) for (i = 0; i < MAX_BUSID; i++) if (busid_table[i][0]) - if (!strncmp(busid_table[i], busid, BUS_ID_SIZE)) { + if (!strncmp(busid_table[i], busid, BUSID_SIZE)) { /* already registerd */ spin_unlock(&busid_table_lock); return 0; @@ -92,7 +93,7 @@ static int add_match_busid(char *busid) for (i = 0; i < MAX_BUSID; i++) if (!busid_table[i][0]) { - strncpy(busid_table[i], busid, BUS_ID_SIZE); + strncpy(busid_table[i], busid, BUSID_SIZE); spin_unlock(&busid_table_lock); return 0; } @@ -109,9 +110,9 @@ static int del_match_busid(char *busid) spin_lock(&busid_table_lock); for (i = 0; i < MAX_BUSID; i++) - if (!strncmp(busid_table[i], busid, BUS_ID_SIZE)) { + if (!strncmp(busid_table[i], busid, BUSID_SIZE)) { /* found */ - memset(busid_table[i], 0, BUS_ID_SIZE); + memset(busid_table[i], 0, BUSID_SIZE); spin_unlock(&busid_table_lock); return 0; } @@ -125,19 +126,19 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf, size_t count) { int len; - char busid[BUS_ID_SIZE]; + char busid[BUSID_SIZE]; if (count < 5) return -EINVAL; /* strnlen() does not include \0 */ - len = strnlen(buf + 4, BUS_ID_SIZE); + len = strnlen(buf + 4, BUSID_SIZE); /* busid needs to include \0 termination */ - if (!(len < BUS_ID_SIZE)) + if (!(len < BUSID_SIZE)) return -EINVAL; - strncpy(busid, buf + 4, BUS_ID_SIZE); + strncpy(busid, buf + 4, BUSID_SIZE); if (!strncmp(buf, "add ", 4)) { |