* [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function
@ 2019-05-21 8:48 kbuild test robot
2019-05-21 13:09 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2019-05-21 8:48 UTC (permalink / raw)
To: Alan Stern; +Cc: kbuild-all, linux-usb, Greg Kroah-Hartman, Johan Hovold
[-- Attachment #1: Type: text/plain, Size: 4982 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
head: 53c7b63f797c96a30c21dd3b781fafaae096a12b
commit: 31e0456de5be379b10fea0fa94a681057114a96e [3/10] media: usb: siano: Fix general protection fault in smsusb
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 31e0456de5be379b10fea0fa94a681057114a96e
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/media//usb/siano/smsusb.c: In function 'smsusb_init_device':
>> drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function [-Wmaybe-uninitialized]
dev->response_alignment = in_maxp - sizeof(struct sms_msg_hdr);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/in_maxp +447 drivers/media//usb/siano/smsusb.c
396
397 static int smsusb_init_device(struct usb_interface *intf, int board_id)
398 {
399 struct smsdevice_params_t params;
400 struct smsusb_device_t *dev;
401 void *mdev;
402 int i, rc;
403 int in_maxp;
404
405 /* create device object */
406 dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
407 if (!dev)
408 return -ENOMEM;
409
410 memset(¶ms, 0, sizeof(params));
411 usb_set_intfdata(intf, dev);
412 dev->udev = interface_to_usbdev(intf);
413 dev->state = SMSUSB_DISCONNECTED;
414
415 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
416 struct usb_endpoint_descriptor *desc =
417 &intf->cur_altsetting->endpoint[i].desc;
418
419 if (desc->bEndpointAddress & USB_DIR_IN) {
420 dev->in_ep = desc->bEndpointAddress;
421 in_maxp = usb_endpoint_maxp(desc);
422 } else {
423 dev->out_ep = desc->bEndpointAddress;
424 }
425 }
426
427 pr_debug("in_ep = %02x, out_ep = %02x\n", dev->in_ep, dev->out_ep);
428 if (!dev->in_ep || !dev->out_ep) { /* Missing endpoints? */
429 smsusb_term_device(intf);
430 return -ENODEV;
431 }
432
433 params.device_type = sms_get_board(board_id)->type;
434
435 switch (params.device_type) {
436 case SMS_STELLAR:
437 dev->buffer_size = USB1_BUFFER_SIZE;
438
439 params.setmode_handler = smsusb1_setmode;
440 params.detectmode_handler = smsusb1_detectmode;
441 break;
442 case SMS_UNKNOWN_TYPE:
443 pr_err("Unspecified sms device type!\n");
444 /* fall-thru */
445 default:
446 dev->buffer_size = USB2_BUFFER_SIZE;
> 447 dev->response_alignment = in_maxp - sizeof(struct sms_msg_hdr);
448
449 params.flags |= SMS_DEVICE_FAMILY2;
450 break;
451 }
452
453 params.device = &dev->udev->dev;
454 params.usb_device = dev->udev;
455 params.buffer_size = dev->buffer_size;
456 params.num_buffers = MAX_BUFFERS;
457 params.sendrequest_handler = smsusb_sendrequest;
458 params.context = dev;
459 usb_make_path(dev->udev, params.devpath, sizeof(params.devpath));
460
461 mdev = siano_media_device_register(dev, board_id);
462
463 /* register in smscore */
464 rc = smscore_register_device(¶ms, &dev->coredev, 0, mdev);
465 if (rc < 0) {
466 pr_err("smscore_register_device(...) failed, rc %d\n", rc);
467 smsusb_term_device(intf);
468 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
469 media_device_unregister(mdev);
470 #endif
471 kfree(mdev);
472 return rc;
473 }
474
475 smscore_set_board_id(dev->coredev, board_id);
476
477 dev->coredev->is_usb_device = true;
478
479 /* initialize urbs */
480 for (i = 0; i < MAX_URBS; i++) {
481 dev->surbs[i].dev = dev;
482 usb_init_urb(&dev->surbs[i].urb);
483 }
484
485 pr_debug("smsusb_start_streaming(...).\n");
486 rc = smsusb_start_streaming(dev);
487 if (rc < 0) {
488 pr_err("smsusb_start_streaming(...) failed\n");
489 smsusb_term_device(intf);
490 return rc;
491 }
492
493 dev->state = SMSUSB_ACTIVE;
494
495 rc = smscore_start_device(dev->coredev);
496 if (rc < 0) {
497 pr_err("smscore_start_device(...) failed\n");
498 smsusb_term_device(intf);
499 return rc;
500 }
501
502 pr_debug("device 0x%p created\n", dev);
503
504 return rc;
505 }
506
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60935 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function
2019-05-21 8:48 [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function kbuild test robot
@ 2019-05-21 13:09 ` Greg Kroah-Hartman
2019-05-21 13:49 ` Alan Stern
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-21 13:09 UTC (permalink / raw)
To: kbuild test robot; +Cc: Alan Stern, kbuild-all, linux-usb, Johan Hovold
On Tue, May 21, 2019 at 04:48:47PM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
> head: 53c7b63f797c96a30c21dd3b781fafaae096a12b
> commit: 31e0456de5be379b10fea0fa94a681057114a96e [3/10] media: usb: siano: Fix general protection fault in smsusb
> config: mips-allmodconfig (attached as .config)
> compiler: mips-linux-gcc (GCC) 8.1.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 31e0456de5be379b10fea0fa94a681057114a96e
> # save the attached .config to linux build tree
> GCC_VERSION=8.1.0 make.cross ARCH=mips
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
False positive, gcc isn't smart enough here.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function
2019-05-21 13:09 ` Greg Kroah-Hartman
@ 2019-05-21 13:49 ` Alan Stern
2019-05-21 14:08 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2019-05-21 13:49 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: kbuild test robot, kbuild-all, linux-usb, Johan Hovold
On Tue, 21 May 2019, Greg Kroah-Hartman wrote:
> On Tue, May 21, 2019 at 04:48:47PM +0800, kbuild test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
> > head: 53c7b63f797c96a30c21dd3b781fafaae096a12b
> > commit: 31e0456de5be379b10fea0fa94a681057114a96e [3/10] media: usb: siano: Fix general protection fault in smsusb
> > config: mips-allmodconfig (attached as .config)
> > compiler: mips-linux-gcc (GCC) 8.1.0
> > reproduce:
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > git checkout 31e0456de5be379b10fea0fa94a681057114a96e
> > # save the attached .config to linux build tree
> > GCC_VERSION=8.1.0 make.cross ARCH=mips
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> > http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
>
> False positive, gcc isn't smart enough here.
Should I send a patch initializing the value to 0 anyway?
Alan Stern
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function
2019-05-21 13:49 ` Alan Stern
@ 2019-05-21 14:08 ` Greg Kroah-Hartman
2019-05-21 15:38 ` [PATCH] media: usb: siano: Fix false-positive "uninitialized variable" warning Alan Stern
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-21 14:08 UTC (permalink / raw)
To: Alan Stern; +Cc: kbuild test robot, kbuild-all, linux-usb, Johan Hovold
On Tue, May 21, 2019 at 09:49:36AM -0400, Alan Stern wrote:
> On Tue, 21 May 2019, Greg Kroah-Hartman wrote:
>
> > On Tue, May 21, 2019 at 04:48:47PM +0800, kbuild test robot wrote:
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
> > > head: 53c7b63f797c96a30c21dd3b781fafaae096a12b
> > > commit: 31e0456de5be379b10fea0fa94a681057114a96e [3/10] media: usb: siano: Fix general protection fault in smsusb
> > > config: mips-allmodconfig (attached as .config)
> > > compiler: mips-linux-gcc (GCC) 8.1.0
> > > reproduce:
> > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > chmod +x ~/bin/make.cross
> > > git checkout 31e0456de5be379b10fea0fa94a681057114a96e
> > > # save the attached .config to linux build tree
> > > GCC_VERSION=8.1.0 make.cross ARCH=mips
> > >
> > > If you fix the issue, kindly add following tag
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > >
> > > Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> > > http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
> >
> > False positive, gcc isn't smart enough here.
>
> Should I send a patch initializing the value to 0 anyway?
Probably :(
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] media: usb: siano: Fix false-positive "uninitialized variable" warning
2019-05-21 14:08 ` Greg Kroah-Hartman
@ 2019-05-21 15:38 ` Alan Stern
0 siblings, 0 replies; 5+ messages in thread
From: Alan Stern @ 2019-05-21 15:38 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: kbuild test robot, kbuild-all, USB list, Johan Hovold
GCC complains about an apparently uninitialized variable recently
added to smsusb_init_device(). It's a false positive, but to silence
the warning this patch adds a trivial initialization.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: kbuild test robot <lkp@intel.com>
CC: <stable@vger.kernel.org>
---
drivers/media/usb/siano/smsusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: usb-devel/drivers/media/usb/siano/smsusb.c
===================================================================
--- usb-devel.orig/drivers/media/usb/siano/smsusb.c
+++ usb-devel/drivers/media/usb/siano/smsusb.c
@@ -400,7 +400,7 @@ static int smsusb_init_device(struct usb
struct smsusb_device_t *dev;
void *mdev;
int i, rc;
- int in_maxp;
+ int in_maxp = 0;
/* create device object */
dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-21 15:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 8:48 [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function kbuild test robot
2019-05-21 13:09 ` Greg Kroah-Hartman
2019-05-21 13:49 ` Alan Stern
2019-05-21 14:08 ` Greg Kroah-Hartman
2019-05-21 15:38 ` [PATCH] media: usb: siano: Fix false-positive "uninitialized variable" warning Alan Stern
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.