On Tue, Sep 09, 2014 at 12:02:43PM +0300, Dan Carpenter wrote:
> Hello Amit Virdi,
>
> The patch ef11982dd7a6: "usb: gadget: zero: Add support for interrupt
> EP" from Aug 22, 2014, leads to the following static checker warning:
>
> drivers/usb/gadget/function/f_sourcesink.c:1498
> f_ss_opts_int_interval_store()
> warn: impossible condition '(num > 4096) => (0-255 > 4096)'
>
> drivers/usb/gadget/function/f_sourcesink.c
> 1482 static ssize_t f_ss_opts_int_interval_store(struct f_ss_opts *opts,
> 1483 const char *page, size_t len)
> 1484 {
> 1485 int ret;
> 1486 u8 num;
> 1487
> 1488 mutex_lock(&opts->lock);
> 1489 if (opts->refcnt) {
> 1490 ret = -EBUSY;
> 1491 goto end;
> 1492 }
> 1493
> 1494 ret = kstrtou8(page, 0, &num);
> 1495 if (ret)
> 1496 goto end;
> 1497
> 1498 if (num > 4096) {
>
> This limit doesn't make sense because num is an 8 bit number.
>
> 1499 ret = -EINVAL;
> 1500 goto end;
> 1501 }
> 1502
> 1503 opts->int_interval = num;
>
> opts->int_interval is 32 bit so probably num should be declared as a u32
> as well.I have a patch from the author to doing just that :-) See https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next -- balbi
signature.asc
Description: Digital signature
