mirror of
https://github.com/oasislinux/oasis.git
synced 2026-02-05 11:33:57 +01:00
55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
From 2ce67cdaf8af1ab4198ef28da002d5275d314c34 Mon Sep 17 00:00:00 2001
|
|
From: Michael Forney <mforney@mforney.org>
|
|
Date: Sun, 16 Aug 2020 18:00:54 -0700
|
|
Subject: [PATCH] Avoid void pointer arithmetic
|
|
|
|
ISO C requires the pointer to be to a complete object type.
|
|
---
|
|
acpi_ids.c | 2 +-
|
|
libnetlink.c | 2 +-
|
|
libnetlink.h | 2 +-
|
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/acpi_ids.c b/acpi_ids.c
|
|
index ba218d7..08271cb 100644
|
|
--- a/acpi_ids.c
|
|
+++ b/acpi_ids.c
|
|
@@ -126,7 +126,7 @@ genl_get_mcast_group_id(struct nlmsghdr *n)
|
|
}
|
|
|
|
/* set attrs to point to the attribute */
|
|
- attrs = (struct rtattr *)(NLMSG_DATA(n) + GENL_HDRLEN);
|
|
+ attrs = (struct rtattr *)((char *)NLMSG_DATA(n) + GENL_HDRLEN);
|
|
/* Read the table from the message into "tb". This actually just */
|
|
/* places pointers into the message into tb[]. */
|
|
parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
|
|
diff --git a/libnetlink.c b/libnetlink.c
|
|
index 23ae7dd..24948bf 100644
|
|
--- a/libnetlink.c
|
|
+++ b/libnetlink.c
|
|
@@ -523,7 +523,7 @@ int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len)
|
|
}
|
|
|
|
memcpy(NLMSG_TAIL(n), data, len);
|
|
- memset((void *) NLMSG_TAIL(n) + len, 0, NLMSG_ALIGN(len) - len);
|
|
+ memset((char *) NLMSG_TAIL(n) + len, 0, NLMSG_ALIGN(len) - len);
|
|
n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len);
|
|
return 0;
|
|
}
|
|
diff --git a/libnetlink.h b/libnetlink.h
|
|
index 8f9cb5e..7b2f8bc 100644
|
|
--- a/libnetlink.h
|
|
+++ b/libnetlink.h
|
|
@@ -53,7 +53,7 @@ extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
|
|
void *jarg);
|
|
|
|
#define NLMSG_TAIL(nmsg) \
|
|
- ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
|
|
+ ((struct rtattr *) (((char *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
|
|
|
|
#ifndef IFA_RTA
|
|
#define IFA_RTA(r) \
|
|
--
|
|
2.37.3
|
|
|