Do not dereference 'siw_crypto_shash' before checking
Reported-by: "Dan Carpenter" <dan.carpenter@oracle.com>
Fixes: f29dd55b02
("rdma/siw: queue pair methods")
Link: https://lore.kernel.org/r/OF61E386ED.49A73798-ON00258444.003BD6A6-00258444.003CC8D9@notes.na.collabserv.com
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
15fe6a8dcc
commit
708637e65a
|
@ -220,12 +220,14 @@ static int siw_qp_enable_crc(struct siw_qp *qp)
|
|||
{
|
||||
struct siw_rx_stream *c_rx = &qp->rx_stream;
|
||||
struct siw_iwarp_tx *c_tx = &qp->tx_ctx;
|
||||
int size = crypto_shash_descsize(siw_crypto_shash) +
|
||||
sizeof(struct shash_desc);
|
||||
int size;
|
||||
|
||||
if (siw_crypto_shash == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
size = crypto_shash_descsize(siw_crypto_shash) +
|
||||
sizeof(struct shash_desc);
|
||||
|
||||
c_tx->mpa_crc_hd = kzalloc(size, GFP_KERNEL);
|
||||
c_rx->mpa_crc_hd = kzalloc(size, GFP_KERNEL);
|
||||
if (!c_tx->mpa_crc_hd || !c_rx->mpa_crc_hd) {
|
||||
|
|
Loading…
Reference in New Issue