Fix infinite loop

Message ID bae09f3a2d1e7df671d811ed64fd2893996dbe1b.1515074681.git.szymon.sliwa@linaro.org
State New
Headers show
Series
  • Fix infinite loop
Related show

Commit Message

Szymon Sliwa Jan. 4, 2018, 2:04 p.m.
linux-dpdk: in odp_crypto.c if increment == 0,
            is_valid_size loops indefinitely

Signed-off-by: Szymon Sliwa <szymon.sliwa@linaro.org>
---
 platform/linux-dpdk/odp_crypto.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Krishna Garapati Jan. 5, 2018, 12:39 p.m. | #1
pls add the prefix "linux-dpdk: crypto" to commit message.

/Krishna

On 4 January 2018 at 15:04, Szymon Sliwa <szymon.sliwa@linaro.org> wrote:

> linux-dpdk: in odp_crypto.c if increment == 0,
>             is_valid_size loops indefinitely
>
> Signed-off-by: Szymon Sliwa <szymon.sliwa@linaro.org>
> ---
>  platform/linux-dpdk/odp_crypto.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_
> crypto.c
> index 40be239..ac8aee9 100644
> --- a/platform/linux-dpdk/odp_crypto.c
> +++ b/platform/linux-dpdk/odp_crypto.c
> @@ -72,6 +72,9 @@ static inline int is_valid_size(uint16_t length,
> uint16_t min,
>         if (length < supp_size)
>                 return -1;
>
> +       if (supp_size != length && increment == 0)
> +               return -1;
> +
>         for (; supp_size <= max; supp_size += increment) {
>                 if (length == supp_size)
>                         return 0;
> --
> 2.7.4
>
> _______________________________________________
> lng-odp-dpdk mailing list
> lng-odp-dpdk@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp-dpdk
>

Patch

diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c
index 40be239..ac8aee9 100644
--- a/platform/linux-dpdk/odp_crypto.c
+++ b/platform/linux-dpdk/odp_crypto.c
@@ -72,6 +72,9 @@  static inline int is_valid_size(uint16_t length, uint16_t min,
 	if (length < supp_size)
 		return -1;
 
+	if (supp_size != length && increment == 0)
+		return -1;
+
 	for (; supp_size <= max; supp_size += increment) {
 		if (length == supp_size)
 			return 0;