Linux-mediatek Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] usb: mtu3: disable USB2 LPM
@ 2020-06-29  6:00 Chunfeng Yun
  2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ 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	[flat|nested] 11+ messages in thread

* [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  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  8:00   ` Markus Elfring
  2020-06-29 16:19   ` Searching for initialisation of variables by function calls before null pointer checks Markus Elfring
  2020-06-29  7:30 ` [PATCH 1/2] usb: mtu3: disable USB2 LPM Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ 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	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 [PATCH 1/2] usb: mtu3: disable USB2 LPM Chunfeng Yun
  2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
@ 2020-06-29  7:30 ` Markus Elfring
  2020-06-29  8:10   ` Greg Kroah-Hartman
  2020-06-29  7:37 ` Peter Chen
  2020-06-29  8:15 ` Markus Elfring
  3 siblings, 1 reply; 11+ 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] 11+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 [PATCH 1/2] usb: mtu3: disable USB2 LPM Chunfeng Yun
  2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
  2020-06-29  7:30 ` [PATCH 1/2] usb: mtu3: disable USB2 LPM Markus Elfring
@ 2020-06-29  7:37 ` Peter Chen
  2020-06-30  7:03   ` Chunfeng Yun
  2020-06-29  8:15 ` Markus Elfring
  3 siblings, 1 reply; 11+ 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] 11+ messages in thread

* Re: [PATCH 2/2] usb: mtu3: fix NULL pointer dereference
  2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
@ 2020-06-29  8:00   ` Markus Elfring
  2020-06-29  8:10     ` Greg Kroah-Hartman
  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
  1 sibling, 2 replies; 11+ 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] 11+ 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
  2020-06-30  7:28     ` Chunfeng Yun
  1 sibling, 0 replies; 11+ 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] 11+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  7:30 ` [PATCH 1/2] usb: mtu3: disable USB2 LPM Markus Elfring
@ 2020-06-29  8:10   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ 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] 11+ messages in thread

* Re: [PATCH 1/2] usb: mtu3: disable USB2 LPM
  2020-06-29  6:00 [PATCH 1/2] usb: mtu3: disable USB2 LPM Chunfeng Yun
                   ` (2 preceding siblings ...)
  2020-06-29  7:37 ` Peter Chen
@ 2020-06-29  8:15 ` Markus Elfring
  3 siblings, 0 replies; 11+ 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] 11+ messages in thread

* Re: Searching for initialisation of variables by function calls before null pointer checks
  2020-06-29  6:00 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
  2020-06-29  8:00   ` Markus Elfring
@ 2020-06-29 16:19   ` Markus Elfring
  1 sibling, 0 replies; 11+ 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] 11+ 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
  0 siblings, 0 replies; 11+ 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] 11+ 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
@ 2020-06-30  7:28     ` Chunfeng Yun
  1 sibling, 0 replies; 11+ 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] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ 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 ` [PATCH 2/2] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
2020-06-29  8:00   ` Markus Elfring
2020-06-29  8:10     ` Greg Kroah-Hartman
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  7:30 ` [PATCH 1/2] usb: mtu3: disable USB2 LPM Markus Elfring
2020-06-29  8:10   ` Greg Kroah-Hartman
2020-06-29  7:37 ` Peter Chen
2020-06-30  7:03   ` Chunfeng Yun
2020-06-29  8:15 ` Markus Elfring

Linux-mediatek Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mediatek/0 linux-mediatek/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mediatek linux-mediatek/ https://lore.kernel.org/linux-mediatek \
		linux-mediatek@lists.infradead.org
	public-inbox-index linux-mediatek

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mediatek


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git