@@ -382,6 +389,9 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)if(!ep)return-EINVAL;+mep=to_mtu3_ep(ep);+mtu=mep->mtu;+dev_dbg(mtu->dev,"%s : %s...",__func__,ep->name);spin_lock_irqsave(&mtu->lock,flags);
@@ -422,11 +432,12 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)/* Sets the halt feature with the clear requests ignored */staticintmtu3_gadget_ep_set_wedge(structusb_ep*ep){-structmtu3_ep*mep=to_mtu3_ep(ep);+structmtu3_ep*mep;if(!ep)return-EINVAL;+mep=to_mtu3_ep(ep);mep->wedged=1;returnusb_ep_set_halt(ep);
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Markus Elfring <hidden> Date: 2020-06-30 10:47:23
Some pointers are dereferenced before successful checks.
I propose to reconsider and improve also this change description.
* Would a null pointer dereference be possible only with the variables “mep”
and “mreq” in the implementation of the function “mtu3_gadget_dequeue”?
(Can it make sense to split the patch according to this detail?)
* How do you think about to convert any more variable initialisations
to later assignments?
* Will it become helpful to add the tag “Fixes” to the commit message?
…
---
v2: nothing changed, but abandon another patch
Are there chances to take any previous patch review comments better into account
(besides the shown reduction of update steps)?
I suggest to replace the triple dashes before this diffstat by a blank line.
Regards,
Markus
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
@@ -422,11 +432,12 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) /* Sets the halt feature with the clear requests ignored */ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep) {- struct mtu3_ep *mep = to_mtu3_ep(ep);+ struct mtu3_ep *mep; if (!ep) return -EINVAL;
@@ -422,11 +432,12 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) /* Sets the halt feature with the clear requests ignored */ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep) {- struct mtu3_ep *mep = to_mtu3_ep(ep);+ struct mtu3_ep *mep; if (!ep) return -EINVAL;
From: Felipe Balbi <balbi@kernel.org> Date: 2020-07-09 06:40:22
Chunfeng Yun [off-list ref] writes:
Some pointers are dereferenced before successful checks.
Reported-by: Markus Elfring <redacted>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
do you need a Fixes tag here? Perhaps a Cc stable too?
--
balbi
From: Felipe Balbi <balbi@kernel.org> Date: 2020-07-09 06:43:07
Hi,
Chunfeng Yun [off-list ref] writes:
quoted
quoted
@@ -373,8 +380,8 @@ static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req) */ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) {- struct mtu3_ep *mep = to_mtu3_ep(ep);- struct mtu3 *mtu = mep->mtu;+ struct mtu3_ep *mep;+ struct mtu3 *mtu; struct mtu3_request *mreq; unsigned long flags; int ret = 0;
@@ -382,6 +389,9 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) if (!ep) return -EINVAL;
Same here, how can that ever happen?
Maybe when the class driver has something wrong:)
You mean it's better to remove these unnecessary checks?
if we need those checks, I'd rather have them at a central location,
such as udc/core.c. But, as Greg mentioned, the kernel doesn't call
these with NULL pointers.
--
balbi
On Thu, 2020-07-09 at 09:40 +0300, Felipe Balbi wrote:
Chunfeng Yun [off-list ref] writes:
quoted
Some pointers are dereferenced before successful checks.
Reported-by: Markus Elfring <redacted>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
do you need a Fixes tag here? Perhaps a Cc stable too?
It will not cause somes issues, I think no need add it.
According to Greg's comment, I guess he means no need check these
pointers at all, so I'll send a new version to remove checks.
Thank you