From: kbuild test robot <lkp@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: kbuild-all@01.org, linux-usb@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johan Hovold <johan@kernel.org>
Subject: [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function
Date: Tue, 21 May 2019 16:48:47 +0800 [thread overview]
Message-ID: <201905211645.tumqhfAz%lkp@intel.com> (raw)
[-- 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 --]
next reply other threads:[~2019-05-21 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 8:48 kbuild test robot [this message]
2019-05-21 13:09 ` [usb:usb-linus 3/10] drivers/media//usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201905211645.tumqhfAz%lkp@intel.com \
--to=lkp@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=kbuild-all@01.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).