[Bug 296346] [PATCH] netlink_snl.h: Fix C++ compilation errors due to implicit void pointer casts*

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 28 Jun 2026 10:24:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296346

            Bug ID: 296346
           Summary: [PATCH] netlink_snl.h: Fix C++ compilation errors due
                    to implicit void pointer casts*
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: cnbatch@gmail.com

Created attachment 272215
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=272215&action=edit
patch netlink_snl.h

The 'snl_realloc_msg_buffer' function in 'sys/netlink/netlink_snl.h' fails to
compile when included in C++ source files. This is because C++ does not allow
implicit conversion from 'void *' (returned by 'snl_allocz') to 'char *'.

This patch addresses the issue by adding an explicit cast to '(char *)'.

Additionally, a redundant '(void *)' cast in the 'nw->hdr' assignment has been
removed, as the explicit '(struct nlmsghdr *)' cast alone is sufficient and
cleaner.

-- 
You are receiving this mail because:
You are the assignee for the bug.