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

Do not dereference 'siw_crypto_shash' before checking

parent 15fe6a8d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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) {