diff options
| author | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
| commit | 1372848511cb896b80b51ed1a3e9606bd9816631 (patch) | |
| tree | 674792b9385bdef935988894b45f06b2af39f88c /src/libnm-platform/nm-netlink.c | |
| parent | 40ec077ea305994c1fc2130add6787ca0c73e2c6 (diff) | |
New upstream version 1.42.0 upstream/1.42.0
Diffstat (limited to 'src/libnm-platform/nm-netlink.c')
| -rw-r--r-- | src/libnm-platform/nm-netlink.c | 7 |
1 files changed, 4 insertions, 3 deletions
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; |