aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-03-17 20:24:18 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-03-20 20:33:15 +0100
commitc48331ca51399fe1779529511be395b576aaf0af (patch)
tree43cfb3b4fe952a88c5c6d448dbf18c5c5e3000ab
parent9866d146e654975dd7f5fd3f1294d5fc4628cef3 (diff)
downloadpasst-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.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/packet.h b/packet.h
index dd18461..9061dad 100644
--- a/packet.h
+++ b/packet.h
@@ -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