staging: go7007: fix use of uninitialised pointer
Subsystems (2)
PATCH 1/1 staging: go7007: fix use of uninitialised pointer
From: Michal Nazarewicz <[email protected]>
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(-)
drivers/staging/media/go7007/go7007-usb.c +1 -1
@@ -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 :
Signature · 1 line
1.8.3.2
Greg Kroah-Hartman
maintainerQuoted 13 lines · Michal Nazarewicz
From: Michal Nazarewicz <[email protected]>
The go variable is declade without initialisation and invocation of
dev_dbgimmediatelly tries to dereference it.--- drivers/staging/media/go7007/go7007-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/go7007/go7007-usb.c +0
-0
drivers/staging/media/go7007/go7007-usb.c static int go7007_usb_probe(struct usb_interface *intf, · line 1060
Quoted 5 lines
drivers/staging/media/go7007/go7007-usb.c +1
-1@@ -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
PATCH 1/7 staging: go7007: fix use of uninitialised pointer
--- drivers/staging/media/go7007/go7007-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines · Greg Kroah-Hartman
Please either delete this entirely, or use the struct device in the
usb_interfacepointer.A driver should never have a "raw" pr_* call.
drivers/staging/media/go7007/go7007-usb.c +1 -1
@@ -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 :
Signature · 1 line
1.8.3.2
There are 3 other uses before "go" gets initialized.
regards,
dan carpenter
PATCH v2 1/1 staging: go7007: fix use of uninitialised pointer
go variable is initialised only after the switch case so it cannot be dereferenced prior to that happening.
--- drivers/staging/media/go7007/go7007-usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 1 line · Dan Carpenter
There are 3 other uses before "go" gets initialized.
Argh... Other occurrences of the letters “GO” deceived my eyes. Sorry about that and thanks.
drivers/staging/media/go7007/go7007-usb.c +4 -4
@@ -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 ; }
Signature · 1 line
1.8.4.1
Quoted 4 lines · Michal Nazarewicz
go variable is initialised only after the switch case so it cannot be dereferenced prior to that happening.
Signed-off-by Michal Nazarewicz <[email protected]>
Looks good. Thanks. :)
regards,
dan carpenter
Greg Kroah-Hartman
maintainerQuoted 8 lines · Michal Nazarewicz
go variable is initialised only after the switch case so it cannot be dereferenced prior to that happening.
Signed-off-by Michal Nazarewicz <[email protected]>--- drivers/staging/media/go7007/go7007-usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 5 lines
Quoted 1 line · Dan Carpenter
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