From 1372848511cb896b80b51ed1a3e9606bd9816631 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 10 Feb 2023 11:50:34 +0100 Subject: New upstream version 1.42.0 --- src/libnm-platform/nm-netlink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libnm-platform/nm-netlink.c') diff --git a/src/libnm-platform/nm-netlink.c b/src/libnm-platform/nm-netlink.c index e08eee5e..fc704226 100644 --- a/src/libnm-platform/nm-netlink.c +++ b/src/libnm-platform/nm-netlink.c @@ -325,7 +325,8 @@ nlmsg_parse_error(const struct nlmsghdr *nlh, const char **out_extack_msg) struct nlattr *tb[G_N_ELEMENTS(policy)]; struct nlattr *tlvs; - tlvs = (struct nlattr *) ((char *) e + sizeof(*e) + e->msg.nlmsg_len - NLMSG_HDRLEN); + tlvs = NM_CAST_ALIGN(struct nlattr, + (((char *) e) + sizeof(*e) + e->msg.nlmsg_len - NLMSG_HDRLEN)); if (nla_parse_arr(tb, tlvs, nlh->nlmsg_len - sizeof(*e) - e->msg.nlmsg_len, policy) >= 0) { if (tb[NLMSGERR_ATTR_MSG]) *out_extack_msg = nla_get_string(tb[NLMSGERR_ATTR_MSG]); @@ -842,7 +843,7 @@ genlmsg_len(const struct genlmsghdr *gnlh) { const struct nlmsghdr *nlh; - nlh = (const struct nlmsghdr *) ((const unsigned char *) gnlh - NLMSG_HDRLEN); + nlh = NM_CAST_ALIGN(const struct nlmsghdr, (((char *) gnlh) - NLMSG_HDRLEN)); return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN); } @@ -1253,7 +1254,7 @@ continue_reading: if (n <= 0) return n; - hdr = (struct nlmsghdr *) buf; + hdr = NM_CAST_ALIGN(struct nlmsghdr, buf); while (nlmsg_ok(hdr, n)) { nm_auto_nlmsg struct nl_msg *msg = NULL; -- cgit 1.3.0-6-gf8a5