diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2025-03-17 20:24:21 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2025-03-20 20:33:22 +0100 |
| commit | 38bcce997763f2e0c4bb6c0a3926674317796544 (patch) | |
| tree | 2681a4b402cdafe6247f1598014d479e6573df48 /contrib/qemu | |
| parent | 961aa6a0eb7fce956a34f8ccd883bfe12392d3d3 (diff) | |
| download | passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar.gz passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar.bz2 passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar.lz passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar.xz passt-38bcce997763f2e0c4bb6c0a3926674317796544.tar.zst passt-38bcce997763f2e0c4bb6c0a3926674317796544.zip | |
packet: Rework packet_get() versus packet_get_try()
Most failures of packet_get() indicate a serious problem, and log messages
accordingly. However, a few callers expect failures here, because they're
probing for a certain range which might or might not be in a packet. They
use packet_get_try() which passes a NULL func to packet_get_do() to
suppress the logging which is unwanted in this case.
However, this doesn't just suppress the log when packet_get_do() finds the
requested region isn't in the packet. It suppresses logging for all other
errors too, which do indicate serious problems, even for the callers of
packet_get_try(). Worse it will pass the NULL func on to
packet_check_range() which doesn't expect it, meaning we'll get unhelpful
messages from there if there is a failure.
Fix this by making packet_get_try_do() the primary function which doesn't
log for the case of a range outside the packet. packet_get_do() becomes a
trivial wrapper around that which logs a message if packet_get_try_do()
returns NULL.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'contrib/qemu')
0 files changed, 0 insertions, 0 deletions
