diff --git a/drivers/crypto/tegra-nvvse-cryptodev.c b/drivers/crypto/tegra-nvvse-cryptodev.c index f2118124..6df9aae3 100644 --- a/drivers/crypto/tegra-nvvse-cryptodev.c +++ b/drivers/crypto/tegra-nvvse-cryptodev.c @@ -227,19 +227,10 @@ static int tnvvse_crypto_validate_sha_update_req(struct tnvvse_crypto_ctx *ctx, goto exit; } - if (sha_update_ctl->input_buffer_size == 0U) { - if (sha_update_ctl->is_last == 0U) { - pr_err("%s(): zero length non-last request is not supported\n", __func__); - ret = -EINVAL; - goto exit; - } - } else { - if (sha_update_ctl->in_buff == NULL) { - pr_err("%s(): input buffer address is NULL for non-zero len req\n", - __func__); - ret = -EINVAL; - goto exit; - } + if ((sha_update_ctl->input_buffer_size == 0U) && (sha_update_ctl->is_last == 0U)) { + pr_err("%s(): zero length non-last request is not supported\n", __func__); + ret = -EINVAL; + goto exit; } if (ctx->is_zero_copy_node) { @@ -273,6 +264,13 @@ static int tnvvse_crypto_validate_sha_update_req(struct tnvvse_crypto_ctx *ctx, goto exit; } + if ((sha_update_ctl->input_buffer_size > 0U) && (sha_update_ctl->in_buff == NULL)) { + pr_err("%s(): input buffer address is NULL for non-zero len req\n", + __func__); + ret = -EINVAL; + goto exit; + } + if (sha_update_ctl->input_buffer_size > ivc_database.max_buffer_size[ctx->node_id]) { pr_err("%s(): Msg size is greater than supported size of %d Bytes\n",