re: usb: gadget: zero: Add support for interrupt EP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

  1504          ret = len;
  1505  end:
  1506          mutex_unlock(&opts->lock);
  1507          return ret;
  1508  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux