logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0001-Avoid-void-pointer-arithmetic.patch (1784B)


  1. From 2ce67cdaf8af1ab4198ef28da002d5275d314c34 Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 16 Aug 2020 18:00:54 -0700
  4. Subject: [PATCH] Avoid void pointer arithmetic
  5. ISO C requires the pointer to be to a complete object type.
  6. ---
  7. acpi_ids.c | 2 +-
  8. libnetlink.c | 2 +-
  9. libnetlink.h | 2 +-
  10. 3 files changed, 3 insertions(+), 3 deletions(-)
  11. diff --git a/acpi_ids.c b/acpi_ids.c
  12. index ba218d7..08271cb 100644
  13. --- a/acpi_ids.c
  14. +++ b/acpi_ids.c
  15. @@ -126,7 +126,7 @@ genl_get_mcast_group_id(struct nlmsghdr *n)
  16. }
  17. /* set attrs to point to the attribute */
  18. - attrs = (struct rtattr *)(NLMSG_DATA(n) + GENL_HDRLEN);
  19. + attrs = (struct rtattr *)((char *)NLMSG_DATA(n) + GENL_HDRLEN);
  20. /* Read the table from the message into "tb". This actually just */
  21. /* places pointers into the message into tb[]. */
  22. parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
  23. diff --git a/libnetlink.c b/libnetlink.c
  24. index 23ae7dd..24948bf 100644
  25. --- a/libnetlink.c
  26. +++ b/libnetlink.c
  27. @@ -523,7 +523,7 @@ int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len)
  28. }
  29. memcpy(NLMSG_TAIL(n), data, len);
  30. - memset((void *) NLMSG_TAIL(n) + len, 0, NLMSG_ALIGN(len) - len);
  31. + memset((char *) NLMSG_TAIL(n) + len, 0, NLMSG_ALIGN(len) - len);
  32. n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len);
  33. return 0;
  34. }
  35. diff --git a/libnetlink.h b/libnetlink.h
  36. index 8f9cb5e..7b2f8bc 100644
  37. --- a/libnetlink.h
  38. +++ b/libnetlink.h
  39. @@ -53,7 +53,7 @@ extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
  40. void *jarg);
  41. #define NLMSG_TAIL(nmsg) \
  42. - ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
  43. + ((struct rtattr *) (((char *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
  44. #ifndef IFA_RTA
  45. #define IFA_RTA(r) \
  46. --
  47. 2.37.3