linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: go7007: fix use of uninitialised pointer
@ 2013-11-10 18:37 Michal Nazarewicz
  2013-11-10 18:52 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-10 18:37 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, linux-media, devel, linux-kernel

From: Michal Nazarewicz <mina86@mina86.com>

The go variable is declade without initialisation and invocation of
dev_dbg immediatelly tries to dereference it.
---
 drivers/staging/media/go7007/go7007-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 58684da..457ab63 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
 	char *name;
 	int video_pipe, i, v_urb_len;
 
-	dev_dbg(go->dev, "probing new GO7007 USB board\n");
+	pr_debug("probing new GO7007 USB board\n");
 
 	switch (id->driver_info) {
 	case GO7007_BOARDID_MATRIX_II:
-- 
1.8.3.2


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

* Re: [PATCH] staging: go7007: fix use of uninitialised pointer
  2013-11-10 18:37 [PATCH] staging: go7007: fix use of uninitialised pointer Michal Nazarewicz
@ 2013-11-10 18:52 ` Greg Kroah-Hartman
  2013-11-10 20:24   ` [PATCH 1/7] " Michal Nazarewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-10 18:52 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, devel, linux-kernel

On Sun, Nov 10, 2013 at 07:37:57PM +0100, Michal Nazarewicz wrote:
> From: Michal Nazarewicz <mina86@mina86.com>
> 
> The go variable is declade without initialisation and invocation of
> dev_dbg immediatelly tries to dereference it.
> ---
>  drivers/staging/media/go7007/go7007-usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
> index 58684da..457ab63 100644
> --- a/drivers/staging/media/go7007/go7007-usb.c
> +++ b/drivers/staging/media/go7007/go7007-usb.c
> @@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
>  	char *name;
>  	int video_pipe, i, v_urb_len;
>  
> -	dev_dbg(go->dev, "probing new GO7007 USB board\n");
> +	pr_debug("probing new GO7007 USB board\n");

Please either delete this entirely, or use the struct device in the
usb_interface pointer.

A driver should never have a "raw" pr_* call.

thanks,

greg k-h

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

* [PATCH 1/7] staging: go7007: fix use of uninitialised pointer
  2013-11-10 18:52 ` Greg Kroah-Hartman
@ 2013-11-10 20:24   ` Michal Nazarewicz
  2013-11-10 21:06     ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-10 20:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, devel, linux-kernel


Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/staging/media/go7007/go7007-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

On Sun, Nov 10 2013, Greg Kroah-Hartman wrote:
> Please either delete this entirely, or use the struct device in the
> usb_interface pointer.
>
> A driver should never have a "raw" pr_* call.

diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 58684da..e8c708c 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
 	char *name;
 	int video_pipe, i, v_urb_len;
 
-	dev_dbg(go->dev, "probing new GO7007 USB board\n");
+	dev_dbg(&intf->dev, "probing new GO7007 USB board\n");
 
 	switch (id->driver_info) {
 	case GO7007_BOARDID_MATRIX_II:
-- 
1.8.3.2

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

* Re: [PATCH 1/7] staging: go7007: fix use of uninitialised pointer
  2013-11-10 20:24   ` [PATCH 1/7] " Michal Nazarewicz
@ 2013-11-10 21:06     ` Dan Carpenter
  2013-11-11 11:46       ` [PATCHv2] " Michal Nazarewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-11-10 21:06 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Greg Kroah-Hartman, devel, linux-media, Hans Verkuil,
	linux-kernel, Mauro Carvalho Chehab

There are 3 other uses before "go" gets initialized.

regards,
dan carpenter


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

* [PATCHv2] staging: go7007: fix use of uninitialised pointer
  2013-11-10 21:06     ` Dan Carpenter
@ 2013-11-11 11:46       ` Michal Nazarewicz
  2013-11-11 13:06         ` Dan Carpenter
  2013-11-25 17:25         ` Greg Kroah-Hartman
  0 siblings, 2 replies; 7+ messages in thread
From: Michal Nazarewicz @ 2013-11-11 11:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, devel, linux-media, Hans Verkuil,
	linux-kernel, Mauro Carvalho Chehab

go variable is initialised only after the switch case so it cannot be
dereferenced prior to that happening.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 drivers/staging/media/go7007/go7007-usb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

On Sun, Nov 10 2013, Dan Carpenter wrote:
> There are 3 other uses before "go" gets initialized.

Argh...  Other occurrences of the letters “GO” deceived my eyes.  Sorry
about that and thanks.

diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 58684da..ee8ab89 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1057,7 +1057,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
 	char *name;
 	int video_pipe, i, v_urb_len;
 
-	dev_dbg(go->dev, "probing new GO7007 USB board\n");
+	dev_dbg(&intf->dev, "probing new GO7007 USB board\n");
 
 	switch (id->driver_info) {
 	case GO7007_BOARDID_MATRIX_II:
@@ -1097,13 +1097,13 @@ static int go7007_usb_probe(struct usb_interface *intf,
 		board = &board_px_tv402u;
 		break;
 	case GO7007_BOARDID_LIFEVIEW_LR192:
-		dev_err(go->dev, "The Lifeview TV Walker Ultra is not supported. Sorry!\n");
+		dev_err(&intf->dev, "The Lifeview TV Walker Ultra is not supported. Sorry!\n");
 		return -ENODEV;
 		name = "Lifeview TV Walker Ultra";
 		board = &board_lifeview_lr192;
 		break;
 	case GO7007_BOARDID_SENSORAY_2250:
-		dev_info(go->dev, "Sensoray 2250 found\n");
+		dev_info(&intf->dev, "Sensoray 2250 found\n");
 		name = "Sensoray 2250/2251";
 		board = &board_sensoray_2250;
 		break;
@@ -1112,7 +1112,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
 		board = &board_ads_usbav_709;
 		break;
 	default:
-		dev_err(go->dev, "unknown board ID %d!\n",
+		dev_err(&intf->dev, "unknown board ID %d!\n",
 				(unsigned int)id->driver_info);
 		return -ENODEV;
 	}
-- 
1.8.4.1


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

* Re: [PATCHv2] staging: go7007: fix use of uninitialised pointer
  2013-11-11 11:46       ` [PATCHv2] " Michal Nazarewicz
@ 2013-11-11 13:06         ` Dan Carpenter
  2013-11-25 17:25         ` Greg Kroah-Hartman
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2013-11-11 13:06 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: devel, Greg Kroah-Hartman, linux-kernel, Hans Verkuil,
	linux-media, Mauro Carvalho Chehab

On Mon, Nov 11, 2013 at 12:46:24PM +0100, Michal Nazarewicz wrote:
> go variable is initialised only after the switch case so it cannot be
> dereferenced prior to that happening.
> 
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>

Looks good.  Thanks.  :)

regards,
dan carpenter


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

* Re: [PATCHv2] staging: go7007: fix use of uninitialised pointer
  2013-11-11 11:46       ` [PATCHv2] " Michal Nazarewicz
  2013-11-11 13:06         ` Dan Carpenter
@ 2013-11-25 17:25         ` Greg Kroah-Hartman
  1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-25 17:25 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Dan Carpenter, devel, linux-kernel, Hans Verkuil, linux-media,
	Mauro Carvalho Chehab

On Mon, Nov 11, 2013 at 12:46:24PM +0100, Michal Nazarewicz wrote:
> go variable is initialised only after the switch case so it cannot be
> dereferenced prior to that happening.
> 
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
> ---
>  drivers/staging/media/go7007/go7007-usb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> On Sun, Nov 10 2013, Dan Carpenter wrote:
> > There are 3 other uses before "go" gets initialized.
> 
> Argh...  Other occurrences of the letters “GO” deceived my eyes.  Sorry
> about that and thanks.

This is no longer needed, as I revertd the patch that caused the
original problems, sorry.

greg k-h

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 18:37 [PATCH] staging: go7007: fix use of uninitialised pointer Michal Nazarewicz
2013-11-10 18:52 ` Greg Kroah-Hartman
2013-11-10 20:24   ` [PATCH 1/7] " Michal Nazarewicz
2013-11-10 21:06     ` Dan Carpenter
2013-11-11 11:46       ` [PATCHv2] " Michal Nazarewicz
2013-11-11 13:06         ` Dan Carpenter
2013-11-25 17:25         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).