On 28 March 2016 at 11:23, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

> Check return codes for Coverity issues:
> https://bugs.linaro.org/show_bug.cgi?id=2129
>
> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
>

Reviewed-by: Mike Holmes <mike.hol...@linaro.org>


> ---
>  platform/linux-generic/odp_system_info.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/platform/linux-generic/odp_system_info.c
> b/platform/linux-generic/odp_system_info.c
> index 395b274..0277c3b 100644
> --- a/platform/linux-generic/odp_system_info.c
> +++ b/platform/linux-generic/odp_system_info.c
> @@ -66,7 +66,8 @@ static int systemcpu_cache_line_size(void)
>
>         if (fgets(str, sizeof(str), file) != NULL) {
>                 /* Read cache line size */
> -               sscanf(str, "%i", &size);
> +               if (sscanf(str, "%i", &size) != 1)
> +                       size = 0;
>         }
>
>         fclose(file);
> @@ -99,7 +100,9 @@ static int huge_page_size(void)
>
>         while ((dirent = readdir(dir)) != NULL) {
>                 int temp = 0;
> -               sscanf(dirent->d_name, "hugepages-%i", &temp);
> +
> +               if (sscanf(dirent->d_name, "hugepages-%i", &temp) != 1)
> +                       continue;
>
>                 if (temp > size)
>                         size = temp;
> @@ -110,7 +113,7 @@ static int huge_page_size(void)
>                 return 0;
>         }
>
> -       return size*1024;
> +       return size * 1024;
>  }
>
>
> --
> 2.7.1.250.gff4ea60
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to