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

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

 



Hello Dan,

On 9/9/2014 2:32 PM, 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.


Yes, you're right. Infact, I submitted a patch [1] yesterday itself doing the change which you're suggesting here.

Regards
Amit Virdi

[1] https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next&id=70aacc5777d1f1ca0a88067c9121ce86441bc4e0
--
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