staging: wilc1000: call linux_sdio_init instead of io_init

Dan Carpenter dan.carpenter at oracle.com
Wed Nov 18 10:30:08 UTC 2015


Hello Glen Lee,

The patch de11ee8b214e: "staging: wilc1000: call linux_sdio_init
instead of io_init" from Nov 6, 2015, leads to the following static
checker warning:

	drivers/staging/wilc1000/wilc_sdio.c:574 sdio_init()
	info: ignoring unreachable code.

drivers/staging/wilc1000/wilc_sdio.c
   553  
   554  static int sdio_init(struct wilc *wilc, wilc_debug_func func)
   555  {
   556          sdio_cmd52_t cmd;
   557          int loop;
   558          u32 chipid;
   559  
   560          memset(&g_sdio, 0, sizeof(wilc_sdio_t));
   561  
   562          g_sdio.dPrint = func;
   563  
   564          if (!linux_sdio_init()) {
   565                  g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
   566                  return 0;
   567          } else {
   568                  return 0;
   569          }
   570  
   571          /**
   572           *      function 0 csa enable
   573           **/
   574          cmd.read_write = 1;

This line is not reachable now.

Really, you should consider runing Smatch over this driver.  Anyway, I
have pasted most of the warnings here.  Based on yesterday's linux-next.
Some of the warnings are not in the released versions of Smatch...

drivers/staging/wilc1000/wilc_wlan.c:1330 wilc_wlan_start() warn: bool is not less than zero.
drivers/staging/wilc1000/host_interface.c:368 handle_set_wfi_drv_handler() warn: 'sem:&hif_sema_driver' is sometimes locked here and sometimes unlocked.
drivers/staging/wilc1000/host_interface.c:1028 Handle_Connect() error: potential null dereference 'hif_drv->usr_conn_req.pu8ssid'.  (kmalloc returns null)
drivers/staging/wilc1000/host_interface.c:1428 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'hif_drv->usr_scan_req.net_info[i]->au8bssid'
drivers/staging/wilc1000/host_interface.c:1429 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'pstrNetworkInfo->au8bssid'
drivers/staging/wilc1000/host_interface.c:1450 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt]->au8bssid'
drivers/staging/wilc1000/host_interface.c:1451 Handle_RcvdNtwrkInfo() warn: this array is probably non-NULL. 'pstrNetworkInfo->au8bssid'
drivers/staging/wilc1000/host_interface.c:1771 Handle_Key() warn: passing freed memory 'pstrHostIFkeyAttr->attr.wep.key'
drivers/staging/wilc1000/host_interface.c:1872 Handle_Key() error: double unlock 'sem:&hif_drv->sem_test_key_block'
drivers/staging/wilc1000/host_interface.c:1933 Handle_Key() error: double unlock 'sem:&hif_drv->sem_test_key_block'
drivers/staging/wilc1000/host_interface.c:2619 Handle_ListenStateExpired() error: potential null dereference 'wid.val'.  (kmalloc returns null)
drivers/staging/wilc1000/host_interface.c:2619 Handle_ListenStateExpired() error: we previously assumed 'wid.val' could be null (see line 2616)
drivers/staging/wilc1000/host_interface.c:2703 Handle_SetMulticastFilter() warn: 0xff is larger than 1 bits
drivers/staging/wilc1000/host_interface.c:2704 Handle_SetMulticastFilter() warn: right shifting more than type allows
drivers/staging/wilc1000/host_interface.c:4062 hif_get_cfg() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'.
  Locked on:   line 3980
  Unlocked on: line 4062
drivers/staging/wilc1000/host_interface.c:4198 host_int_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values'.
  Locked on:   line 4198
  Unlocked on: line 4188
drivers/staging/wilc1000/host_interface.c:4984 host_int_setup_ipaddress() info: ignoring unreachable code.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:731 scan() warn: this array is probably non-NULL. 'request->ssids + i->ssid'
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:732 scan() error: potential null dereference 'strHiddenNetwork.pstrHiddenNetworkInfo'.  (kmalloc returns null)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:1280 add_key() error: potential null dereference 'g_key_gtk_params.key'.  (kmalloc returns null)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2995 add_station() error: buffer overflow 'priv->assoc_stainfo.au8Sta_AssociatedBss' 9 <= 2007
drivers/staging/wilc1000/linux_wlan.c:423 linux_wlan_txq_task() error: double unlock 'sem:&wl->txq_thread_started'
drivers/staging/wilc1000/linux_wlan.c:493 linux_wlan_get_firmware() warn: missing error code here? 'netdev_priv()' failed. 'ret' = '0'
drivers/staging/wilc1000/linux_wlan.c:1014 wilc1000_wlan_init() warn: putting NUL at 'size' might be off-by-one
drivers/staging/wilc1000/linux_wlan.c:1014 wilc1000_wlan_init() error: off-by-one overflow 'Firmware_ver' size 20.  rl = '0-20'
drivers/staging/wilc1000/linux_wlan.c:1363 mac_ioctl() warn: passing uninitialized 'rssi'
drivers/staging/wilc1000/coreconfigurator.c:532 ParseAssocRespInfo() warn: possible memory leak of 'pstrConnectRespInfo'

regards,
dan carpenter


More information about the devel mailing list