Commit 46d7b45a267b3d78c5054b210ff7b6c55bfca42b introduced these code paths.
Test and document them.
Details
With a FreeBSD kernel I was not able to reach some of them. I've documented the tests used.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sbin/ping/ping.c | ||
---|---|---|
1174 ↗ | (On Diff #117025) | I don't really agree with this part of the change. Really we are assuming that the kernel (or rather, the caller of pr_pack()) won't give us malformed/truncated packets. But this could happen as a result of a kernel bug. We've had security bugs in the past wherein the kernel's implementation of raw sockets would omit some validation before passing a packet to userland, and userland didn't handle certain cases because it expected the kernel to handle them. So if we're going to annotate this code path at all, I'd suggest having a comment which explains that we expect these conditions to always be false, but we check anyway out of paranoia. NOTREACHED suggests that the code is provably unreachable, and I don't think it's the right annotation here. |
sbin/ping/ping.c | ||
---|---|---|
1174 ↗ | (On Diff #117025) | I see... good point. I'll update the patch removing the NOTREACHED comments. |