mirror of
https://passt.top/passt
synced 2025-05-30 04:45:34 +02:00
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>
This commit is contained in:
parent
9866d146e6
commit
c48331ca51
1 changed files with 1 additions and 1 deletions
2
packet.h
2
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue