msgb_alloc_headroom: Change size args to be uint16_t

Underlaying APIs (msgb_alloc) use a uint16_t as a type, which means
until now passing a value > 2^16 would succeed providing a msgb with
less space than requested.

Since those are static inline, there's no symbols used by apps, so we
should be safe enough changing the type to be uint16_t, since change
would only be applied at re-compile time.

Change-Id: I83c8222484e4856c68134a1a9d8cf96eb91af1b8
This commit is contained in:
Pau Espin 2021-06-10 14:33:46 +02:00 committed by laforge
parent 42bb125df1
commit af40b0b6b9
1 changed files with 2 additions and 2 deletions

View File

@ -524,7 +524,7 @@ static inline int msgb_l3trim(struct msgb *msg, int l3len)
* followed by \ref msgb_reserve in order to create a new \ref msgb with
* user-specified amount of headroom.
*/
static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, int size, int headroom,
static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, uint16_t size, uint16_t headroom,
const char *name)
{
osmo_static_assert(size >= headroom, headroom_bigger);
@ -546,7 +546,7 @@ static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, int size, int
* followed by \ref msgb_reserve in order to create a new \ref msgb with
* user-specified amount of headroom.
*/
static inline struct msgb *msgb_alloc_headroom(int size, int headroom,
static inline struct msgb *msgb_alloc_headroom(uint16_t size, uint16_t headroom,
const char *name)
{
osmo_static_assert(size >= headroom, headroom_bigger);