All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: wcove: fix uninitialized usbc_irq1 and usbc_irq2
@ 2017-10-11  9:09 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-10-11  9:09 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Calls to regmap_read may fail with an -EINVAL return without setting
usbc_irq1 and usbc_irq2.  The error handling clean up expects these
to have been set (or zero on a failure) and currently may try to
clear the wrong IRQs if the uninitalized garbage values in usbc_irq1
or usbc_irq2 are non-zero.  The simplest fix is to ensure these
variables are initialized to zero.

Detected by CoverityScan, CID#1457737 ("Uninitialized scalar variable")

Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/typec/typec_wcove.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/typec_wcove.c b/drivers/usb/typec/typec_wcove.c
index a47a93ad34b7..4ce30a967962 100644
--- a/drivers/usb/typec/typec_wcove.c
+++ b/drivers/usb/typec/typec_wcove.c
@@ -441,8 +441,8 @@ static int wcove_read_rx_buffer(struct wcove_typec *wcove, void *msg)
 static irqreturn_t wcove_typec_irq(int irq, void *data)
 {
 	struct wcove_typec *wcove = data;
-	unsigned int usbc_irq1;
-	unsigned int usbc_irq2;
+	unsigned int usbc_irq1 = 0;
+	unsigned int usbc_irq2 = 0;
 	unsigned int cc1ctrl;
 	int ret;
 
-- 
2.14.1

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

* [PATCH] usb: typec: wcove: fix uninitialized usbc_irq1 and usbc_irq2
@ 2017-10-11  9:09 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-10-11  9:09 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Calls to regmap_read may fail with an -EINVAL return without setting
usbc_irq1 and usbc_irq2.  The error handling clean up expects these
to have been set (or zero on a failure) and currently may try to
clear the wrong IRQs if the uninitalized garbage values in usbc_irq1
or usbc_irq2 are non-zero.  The simplest fix is to ensure these
variables are initialized to zero.

Detected by CoverityScan, CID#1457737 ("Uninitialized scalar variable")

Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/typec/typec_wcove.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/typec_wcove.c b/drivers/usb/typec/typec_wcove.c
index a47a93ad34b7..4ce30a967962 100644
--- a/drivers/usb/typec/typec_wcove.c
+++ b/drivers/usb/typec/typec_wcove.c
@@ -441,8 +441,8 @@ static int wcove_read_rx_buffer(struct wcove_typec *wcove, void *msg)
 static irqreturn_t wcove_typec_irq(int irq, void *data)
 {
 	struct wcove_typec *wcove = data;
-	unsigned int usbc_irq1;
-	unsigned int usbc_irq2;
+	unsigned int usbc_irq1 = 0;
+	unsigned int usbc_irq2 = 0;
 	unsigned int cc1ctrl;
 	int ret;
 
-- 
2.14.1


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

* Re: [PATCH] usb: typec: wcove: fix uninitialized usbc_irq1 and usbc_irq2
  2017-10-11  9:09 ` Colin King
@ 2017-10-11 10:17   ` Heikki Krogerus
  -1 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2017-10-11 10:17 UTC (permalink / raw)
  To: Colin King; +Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors, linux-kernel

On Wed, Oct 11, 2017 at 10:09:57AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Calls to regmap_read may fail with an -EINVAL return without setting
> usbc_irq1 and usbc_irq2.  The error handling clean up expects these
> to have been set (or zero on a failure) and currently may try to
> clear the wrong IRQs if the uninitalized garbage values in usbc_irq1
> or usbc_irq2 are non-zero.  The simplest fix is to ensure these
> variables are initialized to zero.
> 
> Detected by CoverityScan, CID#1457737 ("Uninitialized scalar variable")
> 
> Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


Thanks,

-- 
heikki

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

* Re: [PATCH] usb: typec: wcove: fix uninitialized usbc_irq1 and usbc_irq2
@ 2017-10-11 10:17   ` Heikki Krogerus
  0 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2017-10-11 10:17 UTC (permalink / raw)
  To: Colin King; +Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors, linux-kernel

On Wed, Oct 11, 2017 at 10:09:57AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Calls to regmap_read may fail with an -EINVAL return without setting
> usbc_irq1 and usbc_irq2.  The error handling clean up expects these
> to have been set (or zero on a failure) and currently may try to
> clear the wrong IRQs if the uninitalized garbage values in usbc_irq1
> or usbc_irq2 are non-zero.  The simplest fix is to ensure these
> variables are initialized to zero.
> 
> Detected by CoverityScan, CID#1457737 ("Uninitialized scalar variable")
> 
> Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


Thanks,

-- 
heikki

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

end of thread, other threads:[~2017-10-11 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11  9:09 [PATCH] usb: typec: wcove: fix uninitialized usbc_irq1 and usbc_irq2 Colin King
2017-10-11  9:09 ` Colin King
2017-10-11 10:17 ` Heikki Krogerus
2017-10-11 10:17   ` Heikki Krogerus

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.