diff mbox

linux-generic: crypto: check 'result' pointer

Message ID 1424990896-27170-1-git-send-email-taras.kondratiuk@linaro.org
State Accepted
Commit c62a66cc893be0bbc93315ef310dd0678cd12a27
Headers show

Commit Message

Taras Kondratiuk Feb. 26, 2015, 10:48 p.m. UTC
Check 'result' pointer before dereferencing it in case of synchronous
operation.

Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 platform/linux-generic/odp_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Maxim Uvarov Feb. 27, 2015, 6:42 a.m. UTC | #1
Merged,
Maxim.

On 02/27/2015 01:53 AM, Robbie King (robking) wrote:
> Reviewed-by: Robert King <robking@cisco.com>
>
> -----Original Message-----
> From: Taras Kondratiuk [mailto:taras.kondratiuk@linaro.org]
> Sent: Thursday, February 26, 2015 5:48 PM
> To: lng-odp@lists.linaro.org
> Cc: Robbie King (robking); Taras Kondratiuk
> Subject: [PATCH] linux-generic: crypto: check 'result' pointer
>
> Check 'result' pointer before dereferencing it in case of synchronous
> operation.
>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>   platform/linux-generic/odp_crypto.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
> index 2f13e2f..f7e6e02 100644
> --- a/platform/linux-generic/odp_crypto.c
> +++ b/platform/linux-generic/odp_crypto.c
> @@ -435,6 +435,8 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
>   		*posted = 1;
>   	} else {
>   		/* Synchronous, simply return results */
> +		if (!result)
> +			return -1;
>   		*result = local_result;
>   
>   		/* Indicate to caller operation was sync */
diff mbox

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 2f13e2f..f7e6e02 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -435,6 +435,8 @@  odp_crypto_operation(odp_crypto_op_params_t *params,
 		*posted = 1;
 	} else {
 		/* Synchronous, simply return results */
+		if (!result)
+			return -1;
 		*result = local_result;
 
 		/* Indicate to caller operation was sync */