ping, this simple patch needs a review.

Maxim.

On 03/28/16 18:23, Maxim Uvarov 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>
---
  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;
  }

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to