linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: kbuild-all@01.org, kjlu@umn.edu, pakki001@umn.edu,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: sierra: fix a missing check of device_create_file
Date: Mon, 25 Mar 2019 10:47:15 +0800	[thread overview]
Message-ID: <201903251039.4BQ4btxI%lkp@intel.com> (raw)
In-Reply-To: <20190324223920.961-1-kjlu@umn.edu>

[-- Attachment #1: Type: text/plain, Size: 3705 bytes --]

Hi Kangjie,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.1-rc2 next-20190322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Kangjie-Lu/usb-sierra-fix-a-missing-check-of-device_create_file/20190325-101328
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-x009-201912 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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/usb/storage/sierra_ms.c: In function 'sierra_ms_init':
>> drivers/usb/storage/sierra_ms.c:199:3: warning: 'swocInfo' may be used uninitialized in this function [-Wmaybe-uninitialized]
      kfree(swocInfo);
      ^~~~~~~~~~~~~~~

vim +/swocInfo +199 drivers/usb/storage/sierra_ms.c

   126	
   127	int sierra_ms_init(struct us_data *us)
   128	{
   129		int result, retries;
   130		struct swoc_info *swocInfo;
   131		struct usb_device *udev;
   132		struct Scsi_Host *sh;
   133	
   134		retries = 3;
   135		result = 0;
   136		udev = us->pusb_dev;
   137	
   138		sh = us_to_host(us);
   139		scsi_get_host_dev(sh);
   140	
   141		/* Force Modem mode */
   142		if (swi_tru_install == TRU_FORCE_MODEM) {
   143			usb_stor_dbg(us, "SWIMS: Forcing Modem Mode\n");
   144			result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
   145			if (result < 0)
   146				usb_stor_dbg(us, "SWIMS: Failed to switch to modem mode\n");
   147			return -EIO;
   148		}
   149		/* Force Mass Storage mode (keep CD-Rom) */
   150		else if (swi_tru_install == TRU_FORCE_MS) {
   151			usb_stor_dbg(us, "SWIMS: Forcing Mass Storage Mode\n");
   152			goto complete;
   153		}
   154		/* Normal TRU-Install Logic */
   155		else {
   156			usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n");
   157	
   158			swocInfo = kmalloc(sizeof(struct swoc_info),
   159					GFP_KERNEL);
   160			if (!swocInfo)
   161				return -ENOMEM;
   162	
   163			retries = 3;
   164			do {
   165				retries--;
   166				result = sierra_get_swoc_info(udev, swocInfo);
   167				if (result < 0) {
   168					usb_stor_dbg(us, "SWIMS: Failed SWoC query\n");
   169					schedule_timeout_uninterruptible(2*HZ);
   170				}
   171			} while (retries && result < 0);
   172	
   173			if (result < 0) {
   174				usb_stor_dbg(us, "SWIMS: Completely failed SWoC query\n");
   175				kfree(swocInfo);
   176				return -EIO;
   177			}
   178	
   179			debug_swoc(&us->pusb_dev->dev, swocInfo);
   180	
   181			/*
   182			 * If there is not Linux software on the TRU-Install device
   183			 * then switch to modem mode
   184			 */
   185			if (!containsFullLinuxPackage(swocInfo)) {
   186				usb_stor_dbg(us, "SWIMS: Switching to Modem Mode\n");
   187				result = sierra_set_ms_mode(udev,
   188					SWIMS_SET_MODE_Modem);
   189				if (result < 0)
   190					usb_stor_dbg(us, "SWIMS: Failed to switch modem\n");
   191				kfree(swocInfo);
   192				return -EIO;
   193			}
   194			kfree(swocInfo);
   195		}
   196	complete:
   197		result = device_create_file(&us->pusb_intf->dev, &dev_attr_truinst);
   198		if (result) {
 > 199			kfree(swocInfo);
   200			return result;
   201		}
   202	
   203		return 0;
   204	}
   205	

---
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: 30841 bytes --]

  reply	other threads:[~2019-03-25  2:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-24 22:39 [PATCH] usb: sierra: fix a missing check of device_create_file Kangjie Lu
2019-03-25  2:47 ` kbuild test robot [this message]
2019-03-25  3:08 ` [PATCH v2] " Kangjie Lu
2019-03-25 14:15   ` Alan Stern
2019-03-26  8:18 ` [PATCH] " Dan Carpenter
2019-03-26  8:23   ` [kbuild] " Dan Carpenter

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=201903251039.4BQ4btxI%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@01.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=stern@rowland.harvard.edu \
    --cc=usb-storage@lists.one-eyed-alien.net \
    /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).