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

nl_l3::add_l3_neigh(): fix potentially random return value #418

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

KanjiMonster
Copy link
Contributor

For IPv6LL neighbors we don't add a host entry, so we never call a function that returns an error code, keeping rv initialized.

Fix this by setting rv to 0 to restore the old behaviour before 55fe069 ("nl_l3: notify routes about IPv6 link local nexthops").

Found by cppcheck:

src/netlink/nl_l3.cc:796:10: warning: Uninitialized variable: rv [uninitvar]
  return rv;
         ^
src/netlink/nl_l3.cc:733:7: note: Assuming condition is false
  if (add_host_entry) {
      ^
src/netlink/nl_l3.cc:796:10: note: Uninitialized variable: rv
  return rv;
         ^

Fixes: 55fe069 ("nl_l3: notify routes about IPv6 link local nexthops")

For IPv6LL neighbors we don't add a host entry, so we never call a
function that returns an error code, keeping rv initialized.

Fix this by setting rv to 0 to restore the old behaviour before
55fe069 ("nl_l3: notify routes about IPv6 link local nexthops").

Found by cppcheck:

src/netlink/nl_l3.cc:796:10: warning: Uninitialized variable: rv [uninitvar]
  return rv;
         ^
src/netlink/nl_l3.cc:733:7: note: Assuming condition is false
  if (add_host_entry) {
      ^
src/netlink/nl_l3.cc:796:10: note: Uninitialized variable: rv
  return rv;
         ^
Fixes: 55fe069 ("nl_l3: notify routes about IPv6 link local nexthops")
Signed-off-by: Jonas Gorski <[email protected]>
@KanjiMonster KanjiMonster marked this pull request as ready for review November 9, 2023 10:01
Copy link
Contributor

@rubensfig rubensfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rubensfig rubensfig merged commit 6f66cec into main Nov 14, 2023
5 checks passed
@rubensfig rubensfig deleted the jogo_add_l3_neigh_uninitialized_value branch November 14, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants