Commit 708637e6 authored by Bernard Metzler's avatar Bernard Metzler Committed by Doug Ledford

Do not dereference 'siw_crypto_shash' before checking

Reported-by: default avatar"Dan Carpenter" <dan.carpenter@oracle.com>
Fixes: f29dd55b ("rdma/siw: queue pair methods")
Link: https://lore.kernel.org/r/OF61E386ED.49A73798-ON00258444.003BD6A6-00258444.003CC8D9@notes.na.collabserv.comSigned-off-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 15fe6a8d
...@@ -220,12 +220,14 @@ static int siw_qp_enable_crc(struct siw_qp *qp) ...@@ -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_rx_stream *c_rx = &qp->rx_stream;
struct siw_iwarp_tx *c_tx = &qp->tx_ctx; struct siw_iwarp_tx *c_tx = &qp->tx_ctx;
int size = crypto_shash_descsize(siw_crypto_shash) + int size;
sizeof(struct shash_desc);
if (siw_crypto_shash == NULL) if (siw_crypto_shash == NULL)
return -ENOENT; return -ENOENT;
size = crypto_shash_descsize(siw_crypto_shash) +
sizeof(struct shash_desc);
c_tx->mpa_crc_hd = kzalloc(size, GFP_KERNEL); c_tx->mpa_crc_hd = kzalloc(size, GFP_KERNEL);
c_rx->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) { if (!c_tx->mpa_crc_hd || !c_rx->mpa_crc_hd) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment