Hello Jay Kamat,
This is a semi-automatic email about new static checker warnings.
The patch 48c2bb0b9cf8: "Fix cg_read_strcmp()" from Sep 7, 2018,
leads to the following Smatch complaint:
./tools/testing/selftests/cgroup/cgroup_util.c:111 cg_read_strcmp()
error: we previously assumed 'expected' could be null (see line 97)
./tools/testing/selftests/cgroup/cgroup_util.c
96 /* Handle the case of comparing against empty string */
97 if (!expected)
^^^^^^^^
Originally, we assumed that expected was non-NULL but we added a check
here. I feel like maybe the intention was to check was supposed to be:
if (expected[0] == '\0')
but that's just a random guess.
98 size = 32;
99 else
100 size = strlen(expected) + 1;
101
102 buf = malloc(size);
103 if (!buf)
104 return -1;
105
106 if (cg_read(cgroup, control, buf, size)) {
107 free(buf);
108 return -1;
109 }
110
111 ret = strcmp(expected, buf);
^^^^^^^^
Unchecked dereference.
112 free(buf);
113 return ret;
regards,
dan carpenter
When test_lwt_seg6local.sh was added commit c99a84eac026
("selftests/bpf: test for seg6local End.BPF action") config fragment
wasn't added, and without CONFIG_LWTUNNEL enabled we see this:
Error: CONFIG_LWTUNNEL is not enabled in this kernel.
selftests: test_lwt_seg6local [FAILED]
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/bpf/config | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config
index 3655508f95fd..dd49df5e2df4 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -19,3 +19,4 @@ CONFIG_CRYPTO_SHA256=m
CONFIG_VXLAN=y
CONFIG_GENEVE=y
CONFIG_NET_CLS_FLOWER=m
+CONFIG_LWTUNNEL=y
--
2.19.1