All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] rdma/siw: queue pair methods
@ 2019-07-26  8:10 Dan Carpenter
  2019-07-27 11:03 ` Bernard Metzler
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-07-26  8:10 UTC (permalink / raw)
  To: bmt; +Cc: linux-rdma

Hello Bernard Metzler,

The patch f29dd55b0236: "rdma/siw: queue pair methods" from Jun 20,
2019, leads to the following static checker warning:

	drivers/infiniband/sw/siw/siw_qp.c:226 siw_qp_enable_crc()
	warn: variable dereferenced before check 'siw_crypto_shash' (see line 223)

drivers/infiniband/sw/siw/siw_qp.c
   219  static int siw_qp_enable_crc(struct siw_qp *qp)
   220  {
   221          struct siw_rx_stream *c_rx = &qp->rx_stream;
   222          struct siw_iwarp_tx *c_tx = &qp->tx_ctx;
   223          int size = crypto_shash_descsize(siw_crypto_shash) +
                                                 ^^^^^^^^^^^^^^^^
Dereferenced inside function.

   224                          sizeof(struct shash_desc);
   225  
   226          if (siw_crypto_shash == NULL)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
Checked too late.

   227                  return -ENOENT;
   228  
   229          c_tx->mpa_crc_hd = kzalloc(size, GFP_KERNEL);
   230          c_rx->mpa_crc_hd = kzalloc(size, GFP_KERNEL);
   231          if (!c_tx->mpa_crc_hd || !c_rx->mpa_crc_hd) {
   232                  kfree(c_tx->mpa_crc_hd);
   233                  kfree(c_rx->mpa_crc_hd);
   234                  c_tx->mpa_crc_hd = NULL;
   235                  c_rx->mpa_crc_hd = NULL;
   236                  return -ENOMEM;
   237          }
   238          c_tx->mpa_crc_hd->tfm = siw_crypto_shash;
   239          c_rx->mpa_crc_hd->tfm = siw_crypto_shash;
   240  
   241          return 0;
   242  }

regards,
dan carpenter

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

end of thread, other threads:[~2019-07-29 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-26  8:10 [bug report] rdma/siw: queue pair methods Dan Carpenter
2019-07-27 11:03 ` Bernard Metzler
2019-07-29 17:36   ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.