All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  6:00 ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-29  6:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: linux-usb, linux-kernel, Chunfeng Yun, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

A SuperSpeed device shall include the USB 2.0 extension descriptor
and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
spec9.6.2.1). But we always don't support it, so disable it by
default, otherwise device will enter LPM suspend mode when
connected to Win10 system.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 9dd0216..50d6a40 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
 	mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
 	/* enable automatical HWRW from L1 */
 	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
+	/* always reject LPM request */
+	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
 
 	/* use new QMU format when HW version >= 0x1003 */
 	if (mtu->gen2cp)
-- 
1.9.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  6:00 ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-29  6:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: linux-usb, linux-kernel, Chunfeng Yun, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

A SuperSpeed device shall include the USB 2.0 extension descriptor
and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
spec9.6.2.1). But we always don't support it, so disable it by
default, otherwise device will enter LPM suspend mode when
connected to Win10 system.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 9dd0216..50d6a40 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
 	mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
 	/* enable automatical HWRW from L1 */
 	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
+	/* always reject LPM request */
+	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
 
 	/* use new QMU format when HW version >= 0x1003 */
 	if (mtu->gen2cp)
-- 
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  2020-06-29  6:00 ` Chunfeng Yun
@ 2020-06-29  6:00   ` Chunfeng Yun
  -1 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-29  6:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: linux-usb, linux-kernel, Chunfeng Yun, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

Some pointers are dereferenced before successful checks.

Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_gadget.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index f93732e..1689ca8 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -332,14 +332,21 @@ static int mtu3_gadget_queue(struct usb_ep *ep,
 
 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
+	struct mtu3_ep *mep;
+	struct mtu3_request *mreq;
 	struct mtu3_request *r;
+	struct mtu3 *mtu;
 	unsigned long flags;
 	int ret = 0;
-	struct mtu3 *mtu = mep->mtu;
 
-	if (!ep || !req || mreq->mep != mep)
+	if (!ep || !req)
+		return -EINVAL;
+
+	mep = to_mtu3_ep(ep);
+	mtu = mep->mtu;
+
+	mreq = to_mtu3_request(req);
+	if (mreq->mep != mep)
 		return -EINVAL;
 
 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
@@ -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;
 
+	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 */
 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;
 
+	mep = to_mtu3_ep(ep);
 	mep->wedged = 1;
 
 	return usb_ep_set_halt(ep);
-- 
1.9.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  6:00   ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-29  6:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: linux-usb, linux-kernel, Chunfeng Yun, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

Some pointers are dereferenced before successful checks.

Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_gadget.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index f93732e..1689ca8 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -332,14 +332,21 @@ static int mtu3_gadget_queue(struct usb_ep *ep,
 
 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
+	struct mtu3_ep *mep;
+	struct mtu3_request *mreq;
 	struct mtu3_request *r;
+	struct mtu3 *mtu;
 	unsigned long flags;
 	int ret = 0;
-	struct mtu3 *mtu = mep->mtu;
 
-	if (!ep || !req || mreq->mep != mep)
+	if (!ep || !req)
+		return -EINVAL;
+
+	mep = to_mtu3_ep(ep);
+	mtu = mep->mtu;
+
+	mreq = to_mtu3_request(req);
+	if (mreq->mep != mep)
 		return -EINVAL;
 
 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
@@ -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;
 
+	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 */
 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;
 
+	mep = to_mtu3_ep(ep);
 	mep->wedged = 1;
 
 	return usb_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

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 ` Chunfeng Yun
  (?)
  (?)
@ 2020-06-29  7:30   ` Markus Elfring
  -1 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  7:30 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: linux-kernel, kernel-janitors

> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

How do you think about a wording variant like the following?

   Change description:
   A SuperSpeed device shall include the USB 2.0 extension descriptor
   and shall support Link Power Management when operating in USB 2.0
   High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
   But we do not support it generally. Thus disable this functionality
   by default.
   Otherwise, the device will enter LPM suspend mode when connected
   to Win10 system.


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  7:30   ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  7:30 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: kernel-janitors, linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

How do you think about a wording variant like the following?

   Change description:
   A SuperSpeed device shall include the USB 2.0 extension descriptor
   and shall support Link Power Management when operating in USB 2.0
   High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
   But we do not support it generally. Thus disable this functionality
   by default.
   Otherwise, the device will enter LPM suspend mode when connected
   to Win10 system.


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  7:30   ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  7:30 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: kernel-janitors, linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

How do you think about a wording variant like the following?

   Change description:
   A SuperSpeed device shall include the USB 2.0 extension descriptor
   and shall support Link Power Management when operating in USB 2.0
   High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
   But we do not support it generally. Thus disable this functionality
   by default.
   Otherwise, the device will enter LPM suspend mode when connected
   to Win10 system.


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  7:30   ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  7:30 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: kernel-janitors, linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

How do you think about a wording variant like the following?

   Change description:
   A SuperSpeed device shall include the USB 2.0 extension descriptor
   and shall support Link Power Management when operating in USB 2.0
   High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
   But we do not support it generally. Thus disable this functionality
   by default.
   Otherwise, the device will enter LPM suspend mode when connected
   to Win10 system.


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 ` Chunfeng Yun
  (?)
@ 2020-06-29  7:37   ` Peter Chen
  -1 siblings, 0 replies; 37+ messages in thread
From: Peter Chen @ 2020-06-29  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Greg Kroah-Hartman, Felipe Balbi, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
LPM support if the device is USB 2.1, how could you deal with it?

Peter

>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/mtu3/mtu3_core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> index 9dd0216..50d6a40 100644
> --- a/drivers/usb/mtu3/mtu3_core.c
> +++ b/drivers/usb/mtu3/mtu3_core.c
> @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
>         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
>         /* enable automatical HWRW from L1 */
>         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> +       /* always reject LPM request */
> +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
>
>         /* use new QMU format when HW version >= 0x1003 */
>         if (mtu->gen2cp)
> --
> 1.9.1
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  7:37   ` Peter Chen
  0 siblings, 0 replies; 37+ messages in thread
From: Peter Chen @ 2020-06-29  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Felipe Balbi, Greg Kroah-Hartman, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
LPM support if the device is USB 2.1, how could you deal with it?

Peter

>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/mtu3/mtu3_core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> index 9dd0216..50d6a40 100644
> --- a/drivers/usb/mtu3/mtu3_core.c
> +++ b/drivers/usb/mtu3/mtu3_core.c
> @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
>         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
>         /* enable automatical HWRW from L1 */
>         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> +       /* always reject LPM request */
> +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
>
>         /* use new QMU format when HW version >= 0x1003 */
>         if (mtu->gen2cp)
> --
> 1.9.1
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  7:37   ` Peter Chen
  0 siblings, 0 replies; 37+ messages in thread
From: Peter Chen @ 2020-06-29  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Felipe Balbi, Greg Kroah-Hartman, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> A SuperSpeed device shall include the USB 2.0 extension descriptor
> and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> spec9.6.2.1). But we always don't support it, so disable it by
> default, otherwise device will enter LPM suspend mode when
> connected to Win10 system.

Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
LPM support if the device is USB 2.1, how could you deal with it?

Peter

>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/mtu3/mtu3_core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> index 9dd0216..50d6a40 100644
> --- a/drivers/usb/mtu3/mtu3_core.c
> +++ b/drivers/usb/mtu3/mtu3_core.c
> @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
>         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
>         /* enable automatical HWRW from L1 */
>         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> +       /* always reject LPM request */
> +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
>
>         /* use new QMU format when HW version >= 0x1003 */
>         if (mtu->gen2cp)
> --
> 1.9.1
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  2020-06-29  6:00   ` Chunfeng Yun
  (?)
  (?)
@ 2020-06-29  8:00     ` Markus Elfring
  -1 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:00 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: linux-kernel, kernel-janitors, Colin Ian King

> Some pointers are dereferenced before successful checks.

I suggest to reconsider and improve the 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”?

* How do you think about to adjust any more variable initialisations?

* Will it become helpful to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:00     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:00 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

I suggest to reconsider and improve the 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”?

* How do you think about to adjust any more variable initialisations?

* Will it become helpful to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:00     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:00 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

I suggest to reconsider and improve the 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”?

* How do you think about to adjust any more variable initialisations?

* Will it become helpful to add the tag “Fixes” to the commit message?

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:00     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:00 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

I suggest to reconsider and improve the 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”?

* How do you think about to adjust any more variable initialisations?

* Will it become helpful to add the tag “Fixes” to the commit message?

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  2020-06-29  8:00     ` Markus Elfring
  (?)
  (?)
@ 2020-06-29  8:10       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Chunfeng Yun, Felipe Balbi, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, kernel-janitors,
	Colin Ian King

On Mon, Jun 29, 2020 at 10:00:22AM +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:10       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, Colin Ian King,
	linux-arm-kernel

On Mon, Jun 29, 2020 at 10:00:22AM +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:10       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, Colin Ian King,
	linux-arm-kernel

On Mon, Jun 29, 2020 at 10:00:22AM +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-29  8:10       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, Colin Ian King,
	linux-arm-kernel

On Mon, Jun 29, 2020 at 10:00:22AM +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  7:30   ` Markus Elfring
  (?)
  (?)
@ 2020-06-29  8:10     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Chunfeng Yun, Felipe Balbi, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, kernel-janitors

On Mon, Jun 29, 2020 at 09:30:58AM +0200, Markus Elfring wrote:
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> How do you think about a wording variant like the following?
> 
>    Change description:
>    A SuperSpeed device shall include the USB 2.0 extension descriptor
>    and shall support Link Power Management when operating in USB 2.0
>    High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
>    But we do not support it generally. Thus disable this functionality
>    by default.
>    Otherwise, the device will enter LPM suspend mode when connected
>    to Win10 system.
> 
> 
> Would you like to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  8:10     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, linux-arm-kernel

On Mon, Jun 29, 2020 at 09:30:58AM +0200, Markus Elfring wrote:
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> How do you think about a wording variant like the following?
> 
>    Change description:
>    A SuperSpeed device shall include the USB 2.0 extension descriptor
>    and shall support Link Power Management when operating in USB 2.0
>    High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
>    But we do not support it generally. Thus disable this functionality
>    by default.
>    Otherwise, the device will enter LPM suspend mode when connected
>    to Win10 system.
> 
> 
> Would you like to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  8:10     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, linux-arm-kernel

On Mon, Jun 29, 2020 at 09:30:58AM +0200, Markus Elfring wrote:
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> How do you think about a wording variant like the following?
> 
>    Change description:
>    A SuperSpeed device shall include the USB 2.0 extension descriptor
>    and shall support Link Power Management when operating in USB 2.0
>    High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
>    But we do not support it generally. Thus disable this functionality
>    by default.
>    Otherwise, the device will enter LPM suspend mode when connected
>    to Win10 system.
> 
> 
> Would you like to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  8:10     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 37+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-29  8:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, linux-usb, kernel-janitors, linux-kernel,
	Matthias Brugger, linux-mediatek, Chunfeng Yun, linux-arm-kernel

On Mon, Jun 29, 2020 at 09:30:58AM +0200, Markus Elfring wrote:
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> How do you think about a wording variant like the following?
> 
>    Change description:
>    A SuperSpeed device shall include the USB 2.0 extension descriptor
>    and shall support Link Power Management when operating in USB 2.0
>    High Speed mode. (See also: USB 3.2 specification 9.6.2.1)
>    But we do not support it generally. Thus disable this functionality
>    by default.
>    Otherwise, the device will enter LPM suspend mode when connected
>    to Win10 system.
> 
> 
> Would you like to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 ` Chunfeng Yun
  (?)
@ 2020-06-29  8:15   ` Markus Elfring
  -1 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:15 UTC (permalink / raw)
  To: Chunfeng Yun, linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger, Peter Chen,
	linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
…

If you would insist to combine the presented update steps for this software module,
a cover letter would be helpful together with following improvements.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68#n785

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  8:15   ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:15 UTC (permalink / raw)
  To: Chunfeng Yun, linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Matthias Brugger, Greg Kroah-Hartman, Peter Chen, Felipe Balbi,
	linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
…

If you would insist to combine the presented update steps for this software module,
a cover letter would be helpful together with following improvements.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68#n785

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  8:15   ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29  8:15 UTC (permalink / raw)
  To: Chunfeng Yun, linux-usb, linux-arm-kernel, linux-mediatek
  Cc: Matthias Brugger, Greg Kroah-Hartman, Peter Chen, Felipe Balbi,
	linux-kernel

> A SuperSpeed device shall include the USB 2.0 extension descriptor
…

If you would insist to combine the presented update steps for this software module,
a cover letter would be helpful together with following improvements.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68#n785

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: Searching for initialisation of variables by function calls before null pointer checks
  2020-06-29  6:00   ` Chunfeng Yun
  (?)
  (?)
@ 2020-06-29 16:19     ` Markus Elfring
  -1 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29 16:19 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, Coccinelle
  Cc: linux-kernel, kernel-janitors, Colin Ian King

> Some pointers are dereferenced before successful checks.

A source code place can be pointed out in an acceptable time frame for
a single file by the following script variant for the semantic patch language.


@display@
expression action1, action2;
expression* pointer1, pointer2;
identifier result1, result2;
statement is, es;
type t1, t2;
@@
 t1 result1 = <+...
*             action1(..., pointer1, ...)
              ...+>;
 ... when any
     when != pointer1
 t2 result2 = <+...
*             action2(..., pointer2, ...)
              ...+>;
 ... when any
     when != pointer1
     when != pointer2
*if (!pointer1 || !pointer2 || ...)
    is
 else
    es


elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --profile --no-loops drivers/usb/mtu3/mtu3_gadget.c ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci
…
@@ -332,14 +332,11 @@ error:

 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
 	struct mtu3_request *r;
 	unsigned long flags;
 	int ret = 0;
 	struct mtu3 *mtu = mep->mtu;

-	if (!ep || !req || mreq->mep != mep)
 		return -EINVAL;

 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
---------------------
profiling result
---------------------
Main total                               : 2.030205 sec          1 count
Main.outfiles computation                : 1.648542 sec          1 count
…
real	0m2,122s
user	0m1,977s
sys	0m0,037s


I have tried this analysis approach out also for source files from
the software “Linux next-20200626”.

elfring@Sonne:~/Projekte/Linux/next-patched> XX=$(date) && spatch --no-loops --timeout 12 -j 4 --chunksize 1 -dir ~/Projekte/Linux/next-patched ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci > ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11.diff 2> ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11-errors.txt; YY=$(date) && echo "$XX | $YY"
Mo 29. Jun 13:54:54 CEST 2020 | Mo 29. Jun 17:22:37 CEST 2020


Unfortunately, a lot of “exceptional” data processing results were logged then.

elfring@Sonne:~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626> grep 'EXN: Coccinelle_modules.Common.Timeout' show_pointer_usage_before_null_check11-errors.txt | wc -l
454


Will such a test run trigger any further development considerations?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: Searching for initialisation of variables by function calls before null pointer checks
@ 2020-06-29 16:19     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29 16:19 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, Coccinelle
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

A source code place can be pointed out in an acceptable time frame for
a single file by the following script variant for the semantic patch language.


@display@
expression action1, action2;
expression* pointer1, pointer2;
identifier result1, result2;
statement is, es;
type t1, t2;
@@
 t1 result1 = <+...
*             action1(..., pointer1, ...)
              ...+>;
 ... when any
     when != pointer1
 t2 result2 = <+...
*             action2(..., pointer2, ...)
              ...+>;
 ... when any
     when != pointer1
     when != pointer2
*if (!pointer1 || !pointer2 || ...)
    is
 else
    es


elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --profile --no-loops drivers/usb/mtu3/mtu3_gadget.c ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci
…
@@ -332,14 +332,11 @@ error:

 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
 	struct mtu3_request *r;
 	unsigned long flags;
 	int ret = 0;
 	struct mtu3 *mtu = mep->mtu;

-	if (!ep || !req || mreq->mep != mep)
 		return -EINVAL;

 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
---------------------
profiling result
---------------------
Main total                               : 2.030205 sec          1 count
Main.outfiles computation                : 1.648542 sec          1 count
…
real	0m2,122s
user	0m1,977s
sys	0m0,037s


I have tried this analysis approach out also for source files from
the software “Linux next-20200626”.

elfring@Sonne:~/Projekte/Linux/next-patched> XX=$(date) && spatch --no-loops --timeout 12 -j 4 --chunksize 1 -dir ~/Projekte/Linux/next-patched ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci > ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11.diff 2> ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11-errors.txt; YY=$(date) && echo "$XX | $YY"
Mo 29. Jun 13:54:54 CEST 2020 | Mo 29. Jun 17:22:37 CEST 2020


Unfortunately, a lot of “exceptional” data processing results were logged then.

elfring@Sonne:~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626> grep 'EXN: Coccinelle_modules.Common.Timeout' show_pointer_usage_before_null_check11-errors.txt | wc -l
454


Will such a test run trigger any further development considerations?

Regards,
Markus

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: Searching for initialisation of variables by function calls before null pointer checks
@ 2020-06-29 16:19     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29 16:19 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, Coccinelle
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

A source code place can be pointed out in an acceptable time frame for
a single file by the following script variant for the semantic patch language.


@display@
expression action1, action2;
expression* pointer1, pointer2;
identifier result1, result2;
statement is, es;
type t1, t2;
@@
 t1 result1 = <+...
*             action1(..., pointer1, ...)
              ...+>;
 ... when any
     when != pointer1
 t2 result2 = <+...
*             action2(..., pointer2, ...)
              ...+>;
 ... when any
     when != pointer1
     when != pointer2
*if (!pointer1 || !pointer2 || ...)
    is
 else
    es


elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --profile --no-loops drivers/usb/mtu3/mtu3_gadget.c ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci
…
@@ -332,14 +332,11 @@ error:

 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
 	struct mtu3_request *r;
 	unsigned long flags;
 	int ret = 0;
 	struct mtu3 *mtu = mep->mtu;

-	if (!ep || !req || mreq->mep != mep)
 		return -EINVAL;

 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
---------------------
profiling result
---------------------
Main total                               : 2.030205 sec          1 count
Main.outfiles computation                : 1.648542 sec          1 count
…
real	0m2,122s
user	0m1,977s
sys	0m0,037s


I have tried this analysis approach out also for source files from
the software “Linux next-20200626”.

elfring@Sonne:~/Projekte/Linux/next-patched> XX=$(date) && spatch --no-loops --timeout 12 -j 4 --chunksize 1 -dir ~/Projekte/Linux/next-patched ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci > ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11.diff 2> ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11-errors.txt; YY=$(date) && echo "$XX | $YY"
Mo 29. Jun 13:54:54 CEST 2020 | Mo 29. Jun 17:22:37 CEST 2020


Unfortunately, a lot of “exceptional” data processing results were logged then.

elfring@Sonne:~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626> grep 'EXN: Coccinelle_modules.Common.Timeout' show_pointer_usage_before_null_check11-errors.txt | wc -l
454


Will such a test run trigger any further development considerations?

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: Searching for initialisation of variables by function calls before null pointer checks
@ 2020-06-29 16:19     ` Markus Elfring
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Elfring @ 2020-06-29 16:19 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, Coccinelle
  Cc: Colin Ian King, kernel-janitors, linux-kernel

> Some pointers are dereferenced before successful checks.

A source code place can be pointed out in an acceptable time frame for
a single file by the following script variant for the semantic patch language.


@display@
expression action1, action2;
expression* pointer1, pointer2;
identifier result1, result2;
statement is, es;
type t1, t2;
@@
 t1 result1 = <+...
*             action1(..., pointer1, ...)
              ...+>;
 ... when any
     when != pointer1
 t2 result2 = <+...
*             action2(..., pointer2, ...)
              ...+>;
 ... when any
     when != pointer1
     when != pointer2
*if (!pointer1 || !pointer2 || ...)
    is
 else
    es


elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --profile --no-loops drivers/usb/mtu3/mtu3_gadget.c ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci
…
@@ -332,14 +332,11 @@ error:

 static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct mtu3_ep *mep = to_mtu3_ep(ep);
-	struct mtu3_request *mreq = to_mtu3_request(req);
 	struct mtu3_request *r;
 	unsigned long flags;
 	int ret = 0;
 	struct mtu3 *mtu = mep->mtu;

-	if (!ep || !req || mreq->mep != mep)
 		return -EINVAL;

 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
---------------------
profiling result
---------------------
Main total                               : 2.030205 sec          1 count
Main.outfiles computation                : 1.648542 sec          1 count
…
real	0m2,122s
user	0m1,977s
sys	0m0,037s


I have tried this analysis approach out also for source files from
the software “Linux next-20200626”.

elfring@Sonne:~/Projekte/Linux/next-patched> XX=$(date) && spatch --no-loops --timeout 12 -j 4 --chunksize 1 -dir ~/Projekte/Linux/next-patched ~/Projekte/Coccinelle/janitor/show_pointer_usage_before_null_check11.cocci > ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11.diff 2> ~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626/show_pointer_usage_before_null_check11-errors.txt; YY=$(date) && echo "$XX | $YY"
Mo 29. Jun 13:54:54 CEST 2020 | Mo 29. Jun 17:22:37 CEST 2020


Unfortunately, a lot of “exceptional” data processing results were logged then.

elfring@Sonne:~/Projekte/Bau/Linux/scripts/Coccinelle/null/next/20200626> grep 'EXN: Coccinelle_modules.Common.Timeout' show_pointer_usage_before_null_check11-errors.txt | wc -l
454


Will such a test run trigger any further development considerations?

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  7:37   ` Peter Chen
  (?)
@ 2020-06-30  7:03     ` Chunfeng Yun
  -1 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:03 UTC (permalink / raw)
  To: Peter Chen
  Cc: Greg Kroah-Hartman, Felipe Balbi, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, 2020-06-29 at 15:37 +0800, Peter Chen wrote:
> On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
> LPM support if the device is USB 2.1, how could you deal with it?
Indeed need support it for SS device, I'll check it again, thanks a lot

> 
> Peter
> 
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/mtu3/mtu3_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> > index 9dd0216..50d6a40 100644
> > --- a/drivers/usb/mtu3/mtu3_core.c
> > +++ b/drivers/usb/mtu3/mtu3_core.c
> > @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
> >         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
> >         /* enable automatical HWRW from L1 */
> >         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> > +       /* always reject LPM request */
> > +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
> >
> >         /* use new QMU format when HW version >= 0x1003 */
> >         if (mtu->gen2cp)
> > --
> > 1.9.1
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-30  7:03     ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:03 UTC (permalink / raw)
  To: Peter Chen
  Cc: Felipe Balbi, Greg Kroah-Hartman, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, 2020-06-29 at 15:37 +0800, Peter Chen wrote:
> On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
> LPM support if the device is USB 2.1, how could you deal with it?
Indeed need support it for SS device, I'll check it again, thanks a lot

> 
> Peter
> 
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/mtu3/mtu3_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> > index 9dd0216..50d6a40 100644
> > --- a/drivers/usb/mtu3/mtu3_core.c
> > +++ b/drivers/usb/mtu3/mtu3_core.c
> > @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
> >         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
> >         /* enable automatical HWRW from L1 */
> >         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> > +       /* always reject LPM request */
> > +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
> >
> >         /* use new QMU format when HW version >= 0x1003 */
> >         if (mtu->gen2cp)
> > --
> > 1.9.1
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-30  7:03     ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:03 UTC (permalink / raw)
  To: Peter Chen
  Cc: Felipe Balbi, Greg Kroah-Hartman, USB list, lkml, linux-mediatek,
	Matthias Brugger, Markus Elfring, linux-arm-kernel

On Mon, 2020-06-29 at 15:37 +0800, Peter Chen wrote:
> On Mon, Jun 29, 2020 at 2:04 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >
> > A SuperSpeed device shall include the USB 2.0 extension descriptor
> > and shall support LPM when operating in USB 2.0 HS mode(see usb3.2
> > spec9.6.2.1). But we always don't support it, so disable it by
> > default, otherwise device will enter LPM suspend mode when
> > connected to Win10 system.
> 
> Linux also supports USB2 LPM. Besides, USB-IF CH9 test will check
> LPM support if the device is USB 2.1, how could you deal with it?
Indeed need support it for SS device, I'll check it again, thanks a lot

> 
> Peter
> 
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/mtu3/mtu3_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
> > index 9dd0216..50d6a40 100644
> > --- a/drivers/usb/mtu3/mtu3_core.c
> > +++ b/drivers/usb/mtu3/mtu3_core.c
> > @@ -604,6 +604,8 @@ static void mtu3_regs_init(struct mtu3 *mtu)
> >         mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
> >         /* enable automatical HWRW from L1 */
> >         mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
> > +       /* always reject LPM request */
> > +       mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_MODE(1));
> >
> >         /* use new QMU format when HW version >= 0x1003 */
> >         if (mtu->gen2cp)
> > --
> > 1.9.1
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  2020-06-29  8:00     ` Markus Elfring
  (?)
  (?)
@ 2020-06-30  7:28       ` Chunfeng Yun
  -1 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:28 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, kernel-janitors,
	Colin Ian King

On Mon, 2020-06-29 at 10:00 +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
Yes, I'll do it if need, thanks

> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
Maybe needn't

> 
> Regards,
> Markus


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-30  7:28       ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:28 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
	linux-kernel, linux-mediatek, Matthias Brugger, Colin Ian King,
	linux-arm-kernel

T24gTW9uLCAyMDIwLTA2LTI5IGF0IDEwOjAwICswMjAwLCBNYXJrdXMgRWxmcmluZyB3cm90ZToN
Cj4gPiBTb21lIHBvaW50ZXJzIGFyZSBkZXJlZmVyZW5jZWQgYmVmb3JlIHN1Y2Nlc3NmdWwgY2hl
Y2tzLg0KPiANCj4gSSBzdWdnZXN0IHRvIHJlY29uc2lkZXIgYW5kIGltcHJvdmUgdGhlIGNoYW5n
ZSBkZXNjcmlwdGlvbi4NCj4gDQo+ICogV291bGQgYSBudWxsIHBvaW50ZXIgZGVyZWZlcmVuY2Ug
YmUgcG9zc2libGUgb25seSB3aXRoIHRoZSB2YXJpYWJsZXMg4oCcbWVw4oCdDQo+ICAgYW5kIOKA
nG1yZXHigJ0gaW4gdGhlIGltcGxlbWVudGF0aW9uIG9mIHRoZSBmdW5jdGlvbiDigJxtdHUzX2dh
ZGdldF9kZXF1ZXVl4oCdPw0KPiANCj4gKiBIb3cgZG8geW91IHRoaW5rIGFib3V0IHRvIGFkanVz
dCBhbnkgbW9yZSB2YXJpYWJsZSBpbml0aWFsaXNhdGlvbnM/DQpZZXMsIEknbGwgZG8gaXQgaWYg
bmVlZCwgdGhhbmtzDQoNCj4gDQo+ICogV2lsbCBpdCBiZWNvbWUgaGVscGZ1bCB0byBhZGQgdGhl
IHRhZyDigJxGaXhlc+KAnSB0byB0aGUgY29tbWl0IG1lc3NhZ2U/DQpNYXliZSBuZWVkbid0DQoN
Cj4gDQo+IFJlZ2FyZHMsDQo+IE1hcmt1cw0KDQo

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-30  7:28       ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:28 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
	linux-kernel, linux-mediatek, Matthias Brugger, Colin Ian King,
	linux-arm-kernel

On Mon, 2020-06-29 at 10:00 +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
Yes, I'll do it if need, thanks

> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
Maybe needn't

> 
> Regards,
> Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
@ 2020-06-30  7:28       ` Chunfeng Yun
  0 siblings, 0 replies; 37+ messages in thread
From: Chunfeng Yun @ 2020-06-30  7:28 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, kernel-janitors,
	linux-kernel, linux-mediatek, Matthias Brugger, Colin Ian King,
	linux-arm-kernel

On Mon, 2020-06-29 at 10:00 +0200, Markus Elfring wrote:
> > Some pointers are dereferenced before successful checks.
> 
> I suggest to reconsider and improve the 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”?
> 
> * How do you think about to adjust any more variable initialisations?
Yes, I'll do it if need, thanks

> 
> * Will it become helpful to add the tag “Fixes” to the commit message?
Maybe needn't

> 
> Regards,
> Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2020-06-30  7:30 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29  6:00 [PATCH 1/2] usb: mtu3: disable USB2 LPM Chunfeng Yun
2020-06-29  6:00 ` Chunfeng Yun
2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
2020-06-29  6:00   ` Chunfeng Yun
2020-06-29  8:00   ` Markus Elfring
2020-06-29  8:00     ` Markus Elfring
2020-06-29  8:00     ` Markus Elfring
2020-06-29  8:00     ` Markus Elfring
2020-06-29  8:10     ` Greg Kroah-Hartman
2020-06-29  8:10       ` Greg Kroah-Hartman
2020-06-29  8:10       ` Greg Kroah-Hartman
2020-06-29  8:10       ` Greg Kroah-Hartman
2020-06-30  7:28     ` Chunfeng Yun
2020-06-30  7:28       ` Chunfeng Yun
2020-06-30  7:28       ` Chunfeng Yun
2020-06-30  7:28       ` Chunfeng Yun
2020-06-29 16:19   ` Searching for initialisation of variables by function calls before null pointer checks Markus Elfring
2020-06-29 16:19     ` Markus Elfring
2020-06-29 16:19     ` Markus Elfring
2020-06-29 16:19     ` Markus Elfring
2020-06-29  7:30 ` [PATCH 1/2] usb: mtu3: disable USB2 LPM Markus Elfring
2020-06-29  7:30   ` Markus Elfring
2020-06-29  7:30   ` Markus Elfring
2020-06-29  7:30   ` Markus Elfring
2020-06-29  8:10   ` Greg Kroah-Hartman
2020-06-29  8:10     ` Greg Kroah-Hartman
2020-06-29  8:10     ` Greg Kroah-Hartman
2020-06-29  8:10     ` Greg Kroah-Hartman
2020-06-29  7:37 ` Peter Chen
2020-06-29  7:37   ` Peter Chen
2020-06-29  7:37   ` Peter Chen
2020-06-30  7:03   ` Chunfeng Yun
2020-06-30  7:03     ` Chunfeng Yun
2020-06-30  7:03     ` Chunfeng Yun
2020-06-29  8:15 ` Markus Elfring
2020-06-29  8:15   ` Markus Elfring
2020-06-29  8:15   ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.