Fix issues reported by SVACE 45/320745/1 accepted/tizen/unified/20241122.171551 accepted/tizen/unified/x/20241218.032540 accepted/tizen/unified/x/asan/20241224.004306
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 21 Nov 2024 23:14:11 +0000 (00:14 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 21 Nov 2024 23:24:14 +0000 (00:24 +0100)
Change-Id: I5ad76a3fd65a16c111539306bf662bf7b6528789

packaging/capi-system-peripheral-io.spec
test/peripheral-io-test.c
test/src/test_peripheral_i2c.c

index b0c4eb399a697e8e019068c5664a2e97cdb19eab..33761ac025530eb19e04f8282c257cbee6727c02 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-system-peripheral-io
 Summary:    Tizen Peripheral Input & Output library
-Version:    0.4.1
+Version:    0.4.2
 Release:    0
 Group:      System & System Tools
 License:    Apache-2.0
index 364858e2d1ff63b06e554bbeb617940afc70c5e8..f70293098cdde3886ba0637788ffe08715c88dc6 100644 (file)
@@ -102,14 +102,14 @@ static int __get_feature(const char *key, bool *feature)
 static bool __skip_check(char *name)
 {
        size_t n = sizeof(skip_test_list) / sizeof(skip_test_list[0]);
-       for (int i = 0; i < n; ++i)
-               if (!strcmp(skip_test_list[i].model_name, model_name) && !strcmp(skip_test_list[i].test_name, name))
+       for (unsigned int u = 0; u < n; ++u)
+               if (!strcmp(skip_test_list[u].model_name, model_name) && !strcmp(skip_test_list[u].test_name, name))
                        return true;
 
        if (i2c_no_stub_driver) {
                n = sizeof(skip_test_list_i2c_no_stub_driver) / sizeof(skip_test_list_i2c_no_stub_driver[0]);
-               for (int i = 0; i < n; i++)
-                       if (!strcmp(skip_test_list_i2c_no_stub_driver[i], name))
+               for (unsigned int u = 0; u < n; u++)
+                       if (!strcmp(skip_test_list_i2c_no_stub_driver[u], name))
                                return true;
        }
        return false;
index d973fa1d4c05df9137bee98aa2f311dd760a9450..00a0fef5e4b9e4fdc3a6d24ed42792d7d61174a8 100644 (file)
@@ -61,7 +61,7 @@ static int __find_stub_driver(void)
                n = fread(name, sizeof(char), sizeof(name), fp);
                fclose(fp);
 
-               if (strncmp(name, "SMBus stub driver", n) == 0) {
+               if (n > 0 && strncmp(name, "SMBus stub driver", n) == 0) {
                        ret = bus;
                        goto cleanup;
                }