[bug report] usb: gadget: f_fs: handle control requests not directed to interface or endpoint

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

 



Hello Felix Hädicke,

The patch 54dfce6d07b0: "usb: gadget: f_fs: handle control requests
not directed to interface or endpoint" from Jun 22, 2016, leads to
the following static checker warning:

	drivers/usb/gadget/function/f_fs.c:3152 ffs_func_req_match()
	warn: always true condition '(((creq->wIndex)) >= 0) => (0-u16max >= 0)'

drivers/usb/gadget/function/f_fs.c
  3140  static bool ffs_func_req_match(struct usb_function *f,
  3141                                 const struct usb_ctrlrequest *creq,
  3142                                 bool config0)
  3143  {
  3144          struct ffs_function *func = ffs_func_from_usb(f);
  3145  
  3146          if (config0 && !(func->ffs->user_flags & FUNCTIONFS_CONFIG0_SETUP))
  3147                  return false;
  3148  
  3149          switch (creq->bRequestType & USB_RECIP_MASK) {
  3150          case USB_RECIP_INTERFACE:
  3151                  return ffs_func_revmap_intf(func,
  3152                                              le16_to_cpu(creq->wIndex) >= 0);
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3153          case USB_RECIP_ENDPOINT:
  3154                  return ffs_func_revmap_ep(func,
  3155                                            le16_to_cpu(creq->wIndex) >= 0);
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This doesn't work, but it's not even clear to me what we are trying to
do here.

  3156          default:
  3157                  return (bool) (func->ffs->user_flags &
  3158                                 FUNCTIONFS_ALL_CTRL_RECIP);
  3159          }
  3160  }

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