Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [bug report] i40iw: add pble resource files
@ 2021-04-13 10:52 Dan Carpenter
  2021-04-14  0:13 ` Saleem, Shiraz
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-04-13 10:52 UTC (permalink / raw)
  To: faisal.latif; +Cc: linux-rdma

Hello Faisal Latif,

The patch 9715830157be: "i40iw: add pble resource files" from Jan 20,
2016, leads to the following static checker warning:

	drivers/infiniband/hw/i40iw/i40iw_pble.c:414 add_pble_pool()
	warn: '&chunk->list' not removed from list

drivers/infiniband/hw/i40iw/i40iw_pble.c
   391          }
   392          pble_rsrc->next_fpm_addr += chunk->size;
   393          i40iw_debug(dev, I40IW_DEBUG_PBLE, "next_fpm_addr = %llx chunk_size[%u] = 0x%x\n",
   394                      pble_rsrc->next_fpm_addr, chunk->size, chunk->size);
   395          pble_rsrc->unallocated_pble -= (chunk->size >> 3);
   396          list_add(&chunk->list, &pble_rsrc->pinfo.clist);
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"chunk" is added to the list.

   397          sd_reg_val = (sd_entry_type == I40IW_SD_TYPE_PAGED) ?
   398                          sd_entry->u.pd_table.pd_page_addr.pa : sd_entry->u.bp.addr.pa;
   399          if (sd_entry->valid)
   400                  return 0;
   401          if (dev->is_pf) {
   402                  ret_code = i40iw_hmc_sd_one(dev, hmc_info->hmc_fn_id,
   403                                              sd_reg_val, idx->sd_idx,
   404                                              sd_entry->entry_type, true);
   405                  if (ret_code) {
   406                          i40iw_pr_err("cqp cmd failed for sd (pbles)\n");
   407                          goto error;
                                ^^^^^^^^^^
We hit an error

   408                  }
   409          }
   410  
   411          sd_entry->valid = true;
   412          return 0;
   413   error:
   414          kfree(chunk);
                ^^^^^^^^^^^^
"chunk" is freed but it's still on the list

   415          return ret_code;
   416  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [bug report] i40iw: add pble resource files
  2021-04-13 10:52 [bug report] i40iw: add pble resource files Dan Carpenter
@ 2021-04-14  0:13 ` Saleem, Shiraz
  0 siblings, 0 replies; 2+ messages in thread
From: Saleem, Shiraz @ 2021-04-14  0:13 UTC (permalink / raw)
  To: Dan Carpenter, Latif, Faisal; +Cc: linux-rdma, Devale, Sindhu

> Subject: [bug report] i40iw: add pble resource files
> 
> Hello Faisal Latif,
> 
> The patch 9715830157be: "i40iw: add pble resource files" from Jan 20, 2016, leads
> to the following static checker warning:
> 
> 	drivers/infiniband/hw/i40iw/i40iw_pble.c:414 add_pble_pool()
> 	warn: '&chunk->list' not removed from list
> 
> drivers/infiniband/hw/i40iw/i40iw_pble.c
>    391          }
>    392          pble_rsrc->next_fpm_addr += chunk->size;
>    393          i40iw_debug(dev, I40IW_DEBUG_PBLE, "next_fpm_addr = %llx
> chunk_size[%u] = 0x%x\n",
>    394                      pble_rsrc->next_fpm_addr, chunk->size, chunk->size);
>    395          pble_rsrc->unallocated_pble -= (chunk->size >> 3);
>    396          list_add(&chunk->list, &pble_rsrc->pinfo.clist);
>                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> "chunk" is added to the list.
> 
>    397          sd_reg_val = (sd_entry_type == I40IW_SD_TYPE_PAGED) ?
>    398                          sd_entry->u.pd_table.pd_page_addr.pa : sd_entry-
> >u.bp.addr.pa;
>    399          if (sd_entry->valid)
>    400                  return 0;
>    401          if (dev->is_pf) {
>    402                  ret_code = i40iw_hmc_sd_one(dev, hmc_info->hmc_fn_id,
>    403                                              sd_reg_val, idx->sd_idx,
>    404                                              sd_entry->entry_type, true);
>    405                  if (ret_code) {
>    406                          i40iw_pr_err("cqp cmd failed for sd (pbles)\n");
>    407                          goto error;
>                                 ^^^^^^^^^^ We hit an error
> 
>    408                  }
>    409          }
>    410
>    411          sd_entry->valid = true;
>    412          return 0;
>    413   error:
>    414          kfree(chunk);
>                 ^^^^^^^^^^^^
> "chunk" is freed but it's still on the list
> 

Hi Dan - Thanks for the report and it looks legit. We will send a fix for it.

Shiraz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 10:52 [bug report] i40iw: add pble resource files Dan Carpenter
2021-04-14  0:13 ` Saleem, Shiraz

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git