Re: [PATCH] usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
Hi, Felix Hädickewrites: > Hello, >> Properly check the return code of ffs_func_revmap_intf() and >> ffs_func_revmap_ep() for a non-negative value. >> >> Instead of checking the return code, the comparison was performed for the >> last >> parameter of the function calls, because of wrong parenthesis. >> >> This also fixes 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)' >> >> Reported-by: Dan Carpenter >> Signed-off-by: Felix Hädicke >> --- >> drivers/usb/gadget/function/f_fs.c | 8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/usb/gadget/function/f_fs.c >> b/drivers/usb/gadget/function/f_fs.c >> index 43aeed6..fcfdc6a 100644 >> --- a/drivers/usb/gadget/function/f_fs.c >> +++ b/drivers/usb/gadget/function/f_fs.c >> @@ -3028,11 +3028,11 @@ static bool ffs_func_req_match(struct usb_function >> *f, >> >> switch (creq->bRequestType & USB_RECIP_MASK) { >> case USB_RECIP_INTERFACE: >> -return ffs_func_revmap_intf(func, >> -le16_to_cpu(creq->wIndex) >= 0); >> +return (ffs_func_revmap_intf(func, >> + le16_to_cpu(creq->wIndex)) >= 0); >> case USB_RECIP_ENDPOINT: >> -return ffs_func_revmap_ep(func, >> - le16_to_cpu(creq->wIndex) >= 0); >> +return (ffs_func_revmap_ep(func, >> + le16_to_cpu(creq->wIndex)) >= 0); >> default: >> return (bool) (func->ffs->user_flags & >> FUNCTIONFS_ALL_CTRL_RECIP); > > is there a chance to get this fix into 4.9? as you didn't add a "Fixes: blablabla" I assumed this felt into "has never worked before", now this sits in my immutable 'next' branch. I'll see if I can still send a pull request to Greg for v4.9 final. -- balbi signature.asc Description: PGP signature
Re: [PATCH] usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
Hello, > Properly check the return code of ffs_func_revmap_intf() and > ffs_func_revmap_ep() for a non-negative value. > > Instead of checking the return code, the comparison was performed for the last > parameter of the function calls, because of wrong parenthesis. > > This also fixes 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)' > > Reported-by: Dan Carpenter> Signed-off-by: Felix Hädicke > --- > drivers/usb/gadget/function/f_fs.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_fs.c > b/drivers/usb/gadget/function/f_fs.c > index 43aeed6..fcfdc6a 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -3028,11 +3028,11 @@ static bool ffs_func_req_match(struct usb_function *f, > > switch (creq->bRequestType & USB_RECIP_MASK) { > case USB_RECIP_INTERFACE: > - return ffs_func_revmap_intf(func, > - le16_to_cpu(creq->wIndex) >= 0); > + return (ffs_func_revmap_intf(func, > + le16_to_cpu(creq->wIndex)) >= 0); > case USB_RECIP_ENDPOINT: > - return ffs_func_revmap_ep(func, > - le16_to_cpu(creq->wIndex) >= 0); > + return (ffs_func_revmap_ep(func, > +le16_to_cpu(creq->wIndex)) >= 0); > default: > return (bool) (func->ffs->user_flags & > FUNCTIONFS_ALL_CTRL_RECIP); is there a chance to get this fix into 4.9? Regards, Felix -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
Properly check the return code of ffs_func_revmap_intf() and ffs_func_revmap_ep() for a non-negative value. Instead of checking the return code, the comparison was performed for the last parameter of the function calls, because of wrong parenthesis. This also fixes 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)' Reported-by: Dan CarpenterSigned-off-by: Felix Hädicke --- drivers/usb/gadget/function/f_fs.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 43aeed6..fcfdc6a 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -3028,11 +3028,11 @@ static bool ffs_func_req_match(struct usb_function *f, switch (creq->bRequestType & USB_RECIP_MASK) { case USB_RECIP_INTERFACE: - return ffs_func_revmap_intf(func, - le16_to_cpu(creq->wIndex) >= 0); + return (ffs_func_revmap_intf(func, +le16_to_cpu(creq->wIndex)) >= 0); case USB_RECIP_ENDPOINT: - return ffs_func_revmap_ep(func, - le16_to_cpu(creq->wIndex) >= 0); + return (ffs_func_revmap_ep(func, + le16_to_cpu(creq->wIndex)) >= 0); default: return (bool) (func->ffs->user_flags & FUNCTIONFS_ALL_CTRL_RECIP); -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html