-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Unnecessary non-Nil Check in ipallocator.go #125512
Comments
That is indeed redundant. It seems like someone forgot to remove after a refactor but It was added this way in b022475. |
@darren Feel free to send a pull request by following https://kubernetes.io/docs/contribute/. Thanks. |
Thanks! I am wondering whether it is necessary to check ip address returned by calling But I don't find the overflowed cases yet. |
/sig network |
/assign DrAuYueng |
Hmmm, in theory yes, since .Next() and .Prev() can return an empty netip.Addr. In practice, they probably never overflow in this particular case. Adding a check for .IsValid() for both Prev and Next would not hurt. I don't expect the path of !ip.IsValid() to be ever taken in these cases, but if they do then that is a bug and it should propagate an error. |
/triage accepted |
kubernetes/pkg/registry/core/service/ipallocator/ipallocator.go
Lines 83 to 107 in 6ac6016
The err is already checked on line 84, so it will always be nil On line 107, the check is redundant
The text was updated successfully, but these errors were encountered: