logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 4a7996e2c966d051a6b8bd06138d3f719a01240c
parent 0bfc011f7c69c5eb338cdd6aab1e2ffebfbc4267
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 30 Jan 2020 14:16:08 -0800

libnl: More portability fixes

Diffstat:

Apkg/libnl/patch/0006-Avoid-use-of-alloca-and-statement-expressions.patch76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/libnl/ver2+-
2 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/pkg/libnl/patch/0006-Avoid-use-of-alloca-and-statement-expressions.patch b/pkg/libnl/patch/0006-Avoid-use-of-alloca-and-statement-expressions.patch @@ -0,0 +1,76 @@ +From f64cfa931a450ffb08cbbdeb6652b424f6bb8187 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 30 Jan 2020 14:12:35 -0800 +Subject: [PATCH] Avoid use of alloca and statement expressions + +--- + include/netlink-private/utils.h | 21 --------------------- + lib/genl/mngt.c | 13 +++++++++---- + 2 files changed, 9 insertions(+), 25 deletions(-) + +diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h +index 1456797..e26399f 100644 +--- a/include/netlink-private/utils.h ++++ b/include/netlink-private/utils.h +@@ -93,27 +93,6 @@ extern const char *nl_strerror_l(int err); + + /*****************************************************************************/ + +-#define _nl_malloc_maybe_a(alloca_maxlen, bytes, to_free) \ +- ({ \ +- const size_t _bytes = (bytes); \ +- __typeof__ (to_free) _to_free = (to_free); \ +- __typeof__ (*_to_free) _ptr; \ +- \ +- _NL_STATIC_ASSERT ((alloca_maxlen) <= 500); \ +- _nl_assert (_to_free && !*_to_free); \ +- \ +- if (_bytes <= (alloca_maxlen)) { \ +- _ptr = alloca (_bytes); \ +- } else { \ +- _ptr = malloc (_bytes); \ +- *_to_free = _ptr; \ +- }; \ +- \ +- _ptr; \ +- }) +- +-/*****************************************************************************/ +- + static inline char * + _nl_strncpy_trunc(char *dst, const char *src, size_t len) + { +diff --git a/lib/genl/mngt.c b/lib/genl/mngt.c +index ff50e1d..8f92122 100644 +--- a/lib/genl/mngt.c ++++ b/lib/genl/mngt.c +@@ -54,7 +54,7 @@ static int cmd_msg_parser(struct sockaddr_nl *who, struct nlmsghdr *nlh, + int err; + struct genlmsghdr *ghdr; + struct genl_cmd *cmd; +- struct nlattr **tb; ++ struct nlattr **tb, *tb_local[32]; + + ghdr = genlmsg_hdr(nlh); + +@@ -64,9 +64,14 @@ static int cmd_msg_parser(struct sockaddr_nl *who, struct nlmsghdr *nlh, + if (cmd->c_msg_parser == NULL) + return -NLE_OPNOTSUPP; + +- tb = _nl_malloc_maybe_a (300, (((size_t) cmd->c_maxattr) + 1u) * sizeof (struct nlattr *), &tb_free); +- if (!tb) +- return -NLE_NOMEM; ++ if (cmd->c_maxattr > ARRAY_SIZE(tb_local) - 1) { ++ tb = malloc(((size_t) cmd->c_maxattr + 1u) * sizeof (struct nlattr *)); ++ if (!tb) ++ return -NLE_NOMEM; ++ tb_free = tb; ++ } else { ++ tb = tb_local; ++ } + + err = nlmsg_parse(nlh, + GENL_HDRSIZE(ops->o_hdrsize), +-- +2.25.0 + diff --git a/pkg/libnl/ver b/pkg/libnl/ver @@ -1 +1 @@ -3.5.0 r0 +3.5.0 r1