On 8/3/23 22:13, Dan Carpenter wrote:
On Thu, Aug 03, 2023 at 01:43:33PM -0700, Kui-Feng Lee wrote:
113 int err;
114
115 addr.sin6_port = htons(get_sock_port_v6(listen_fd));
--> 116 if (addr.sin6_port < 0)
^^^^^^^^^^^^^^^^^^
Impossible and also it doesn't make sense to compare network endian data
with < 0.
Hi Dan,
Thank you for pointing it out. It should check the returned value
of get_sock_port_v6() before calling htons(). I will send a patch
to fix it asap.
Could you show me how to run Smatch againt bpf selftests?
Oh wow... You don't want to know. So sometimes I'll go through and
do a `find -name \*.c` and if there isn't a matching .o file I'll just
run:
~/path/to/smatch tools/testing/selftests/bpf/prog_tests/cgroup_tcp_skb.c
Smatch has a thing where if the .h file is missing it will just include
the nearest .h file with a similar name. This doesn't work well and
generates a ton of errors. But I grep the output for specific types
of errors like "is never less than zero".
Got it! Thanks!
regards,
dan carpenter