aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-05-11 20:03:15 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-05-12 00:03:02 +0200
commit1e6b638b490918386292e79efc8f62311e4a9f2f (patch)
tree887fe8b2be5774d2485ccc3750a7e605de593cc7
parent1afd4edb0eab5cb06197ab721739aa8dfef4b3ce (diff)
downloadpasst-1e6b638b490918386292e79efc8f62311e4a9f2f.tar
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.tar.gz
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.tar.bz2
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.tar.lz
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.tar.xz
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.tar.zst
passt-1e6b638b490918386292e79efc8f62311e4a9f2f.zip
netlink: erromsg should be const in nl_status()
This pointer aliases part of the const nlmsghdr we're passed, so it should be const. While we're there, remove an unnecessary explicit cast (NLMSG_DATA() returns a void *, which implicitly casts to anything). This also removes a warning on cppcheck 2.20.0 and probably many other versions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--netlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/netlink.c b/netlink.c
index 6b74e88..9076462 100644
--- a/netlink.c
+++ b/netlink.c
@@ -170,7 +170,7 @@ static int nl_status(const struct nlmsghdr *nh, ssize_t n, uint32_t seq)
return 0;
}
if (nh->nlmsg_type == NLMSG_ERROR) {
- struct nlmsgerr *errmsg = (struct nlmsgerr *)NLMSG_DATA(nh);
+ const struct nlmsgerr *errmsg = NLMSG_DATA(nh);
return errmsg->error;
}