diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2025-03-17 20:24:18 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-03-20 20:33:15 +0100 |
commit | c48331ca51399fe1779529511be395b576aaf0af (patch) | |
tree | 43cfb3b4fe952a88c5c6d448dbf18c5c5e3000ab | |
parent | 9866d146e654975dd7f5fd3f1294d5fc4628cef3 (diff) | |
download | passt-c48331ca51399fe1779529511be395b576aaf0af.tar passt-c48331ca51399fe1779529511be395b576aaf0af.tar.gz passt-c48331ca51399fe1779529511be395b576aaf0af.tar.bz2 passt-c48331ca51399fe1779529511be395b576aaf0af.tar.lz passt-c48331ca51399fe1779529511be395b576aaf0af.tar.xz passt-c48331ca51399fe1779529511be395b576aaf0af.tar.zst passt-c48331ca51399fe1779529511be395b576aaf0af.zip |
packet: Correct type of PACKET_MAX_LEN
PACKET_MAX_LEN is usually involved in calculations on size_t values - the
type of the iov_len field in struct iovec. However, being defined bare as
UINT16_MAX, the compiled is likely to assign it a shorter type. This can
lead to unexpected promotions (or lack thereof). Add a cast to force the
type to be what we expect.
Fixes: c43972ad6 ("packet: Give explicit name to maximum packet size")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | packet.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -9,7 +9,7 @@ #include <stdbool.h> /* Maximum size of a single packet stored in pool, including headers */ -#define PACKET_MAX_LEN UINT16_MAX +#define PACKET_MAX_LEN ((size_t)UINT16_MAX) /** * struct pool - Generic pool of packets stored in a buffer |