Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Warning when building the BPF filter code on CentOS 8 #10988

Closed
rgacogne opened this issue Nov 16, 2021 · 2 comments · Fixed by #10993
Closed

dnsdist: Warning when building the BPF filter code on CentOS 8 #10988

rgacogne opened this issue Nov 16, 2021 · 2 comments · Fixed by #10993

Comments

@rgacogne
Copy link
Member

  • Program: dnsdist
  • Issue type: Bug report

Short description

I just saw these warnings in the CentOS 8 build log:

bpf-filter.cc:50:5: warning: no previous declaration for 'int bpf_pin_map(int, const string&)' [-Wmissing-declarations]
 int bpf_pin_map(int fd, const std::string& path)
     ^~~~~~~~~~~
bpf-filter.cc:59:5: warning: no previous declaration for 'int bpf_load_pinned_map(const string&)' [-Wmissing-declarations]
 int bpf_load_pinned_map(const std::string& path)
     ^~~~~~~~~~~~~~~~~~~
bpf-filter.cc:67:6: warning: no previous declaration for 'void bpf_check_map_sizes(int, uint32_t, uint32_t)' [-Wmissing-declarations]
 void bpf_check_map_sizes(int fd, uint32_t expectedKeySize, uint32_t expectedValueSize)
      ^~~~~~~~~~~~~~~~~~~
bpf-filter.cc: In member function 'void BPFFilter::block(const DNSName&, BPFFilter::MatchAction, uint16_t)':
bpf-filter.cc:478:42: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct CounterAndActionValue'; use assignment or value-initialization instead [-Wclass-memaccess]
     memset(&cadvalue, 0, sizeof(cadvalue));
                                          ^
bpf-filter.cc:192:8: note: 'struct CounterAndActionValue' declared here
 struct CounterAndActionValue
        ^~~~~~~~~~~~~~~~~~~~~
bpf-filter.cc:484:38: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct QNameValue'; use assignment or value-initialization instead [-Wclass-memaccess]
     memset(&qvalue, 0, sizeof(qvalue));
                                      ^
bpf-filter.cc:186:8: note: 'struct QNameValue' declared here
 struct QNameValue
        ^~~~~~~~~~

I will have to fix these before 1.7.0 final.

@rgacogne
Copy link
Member Author

Also a warning reported by clang++:

remote_logger.cc:50:10: warning: variable 'total' set but not used [-Wunused-but-set-variable]
  size_t total = 0;

@rgacogne
Copy link
Member Author

clang's static analyzer is also reporting that we let d_pendingResponses in a unspecified state after moving it inTCPConnectionToBackend::notifyAllQueriesFailed:

auto pendingResponses = std::move(d_pendingResponses);

then uses it in TCPConnectionToBackend::release():

d_ds->outstanding -= d_pendingResponses.size();

In practice I don't expect any surprises but we should put it in a known state by calling clear() on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant