[systemd-devel] Warnings from recent commits

Thomas H.P. Andersen phomes at gmail.com
Sat Jul 19 01:28:19 PDT 2014


On Thu, Jul 17, 2014 at 8:51 PM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> From recent commits I have noticed the following new issues from
> static analysis with scan-build and with clang. I am not sure how they
> should be fixed (or even if) but I just though I would let you know.
>
> 1) src/shared/barrier.c in barrier_read starting at line 274
>
> if (pfd[1].revents) {
>         len = read(b->them, &buf, sizeof(buf));
>         ...
> } else if (pfd[0].revents & (POLLHUP | POLLERR | POLLNVAL)) {
>         ...
>         buf = BARRIER_ABORTION;
> }
>
> If neither if/else if are true then buf will be used unset.
>
> 2) src/resolve/resolved-dns-scope.c in dns_scope_tcp_socket
> if s->link is null then ifindex will not be set but will be used later in:
>
> } else if (srv->family == AF_INET6) {
>         sa.in6.sin6_port = htobe16(53);
>         sa.in6.sin6_addr = srv->address.in6;
>         sa.in6.sin6_scope_id = ifindex;
>         salen = sizeof(sa.in6);

Zbigniew dealt with 2) in 901fd8164797f3eeb9921c85915dc409d49ab5d8.

> 3) I see a couple of these:
>
> In file included from src/resolve/resolved-gperf.c:8:
> In file included from ./src/resolve/resolved.h:34:
> In file included from ./src/resolve/resolved-dns-query.h:33:
> In file included from ./src/resolve/resolved-dns-scope.h:33:
> ./src/resolve/resolved-dns-cache.h:45:3: warning: redefinition of
> typedef 'DnsCacheItem' is a C11 feature [-Wtypedef-redefinition]
> } DnsCacheItem;
>   ^
> ./src/resolve/resolved-dns-cache.h:31:29: note: previous definition is here
> typedef struct DnsCacheItem DnsCacheItem;
>                             ^
> 1 warning generated.


More information about the systemd-devel mailing list