Hello Jesse Brandeburg,

The patch 895106a577c4: "i40e: trivial fixes" from Nov 26, 2013,
leads to the following static checker warning:

        drivers/net/ethernet/intel/i40e/i40e_hmc.c:107 i40e_add_sd_table_entry()
        error: potentially using uninitialized 'ret_code'.

(This warning is from a pre-release version of Smatch).

drivers/net/ethernet/intel/i40e/i40e_hmc.c
    67          sd_entry = &hmc_info->sd_table.sd_entry[sd_index];
    68          if (!sd_entry->valid) {
                     ^^^^^^^^^^^^^^^
If valid is true then "ret_code" is used uninitialized.

    69                  if (I40E_SD_TYPE_PAGED == type) {
    70                          mem_type = i40e_mem_pd;
    71                          alloc_len = I40E_HMC_PAGED_BP_SIZE;
    72                  } else {
    73                          mem_type = i40e_mem_bp_jumbo;
    74                          alloc_len = direct_mode_sz;
    75                  }
    76  
    77                  /* allocate a 4K pd page or 2M backing page */
    78                  ret_code = i40e_allocate_dma_mem(hw, &mem, mem_type, 
alloc_len,
    79                                                   
I40E_HMC_PD_BP_BUF_ALIGNMENT);
    80                  if (ret_code)
    81                          goto exit;
    82                  dma_mem_alloc_done = true;
    83                  if (I40E_SD_TYPE_PAGED == type) {
    84                          ret_code = i40e_allocate_virt_mem(hw,
    85                                          
&sd_entry->u.pd_table.pd_entry_virt_mem,
    86                                          sizeof(struct 
i40e_hmc_pd_entry) * 512);
    87                          if (ret_code)
    88                                  goto exit;
    89                          sd_entry->u.pd_table.pd_entry =
    90                                  (struct i40e_hmc_pd_entry *)
    91                                  
sd_entry->u.pd_table.pd_entry_virt_mem.va;
    92                          sd_entry->u.pd_table.pd_page_addr = mem;
    93                  } else {
    94                          sd_entry->u.bp.addr = mem;
    95                          sd_entry->u.bp.sd_pd_index = sd_index;
    96                  }
    97                  /* initialize the sd entry */
    98                  hmc_info->sd_table.sd_entry[sd_index].entry_type = type;
    99  
   100                  /* increment the ref count */
   101                  I40E_INC_SD_REFCNT(&hmc_info->sd_table);
   102          }
   103          /* Increment backing page reference count */
   104          if (I40E_SD_TYPE_DIRECT == sd_entry->entry_type)
   105                  I40E_INC_BP_REFCNT(&sd_entry->u.bp);
   106  exit:
   107          if (ret_code)
                    ^^^^^^^^
Here.

   108                  if (dma_mem_alloc_done)
   109                          i40e_free_dma_mem(hw, &mem);

regards,
dan carpenter

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to