* [PATCH] netlink: Use const rtnh pointer
@ 2024-02-12 4:05 David Gibson
2024-02-12 16:57 ` Stefano Brivio
2024-02-14 9:14 ` Stefano Brivio
0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2024-02-12 4:05 UTC (permalink / raw)
To: passt-dev, Stefano Brivio; +Cc: David Gibson
6c7623d07 ("netlink: Add support to fetch default gateway from multipath
routes") inadvertently introduced a new cppcheck warning for a variable
which could be a const pointer but isn't. This occurs with
cppcheck-2.13.0-1.fc39.x86_64 in Fedora 39 at least.
Fixes: 6c7623d07 ("netlink: Add support to fetch default gateway from multipath
routes")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netlink.c b/netlink.c
index f0b04cb1..9e7cccb4 100644
--- a/netlink.c
+++ b/netlink.c
@@ -274,7 +274,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
if (rta->rta_type == RTA_OIF) {
ifi = *(unsigned int *)RTA_DATA(rta);
} else if (rta->rta_type == RTA_MULTIPATH) {
- struct rtnexthop *rtnh;
+ const struct rtnexthop *rtnh;
rtnh = (struct rtnexthop *)RTA_DATA(rta);
ifi = rtnh->rtnh_ifindex;
--
@@ -274,7 +274,7 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
if (rta->rta_type == RTA_OIF) {
ifi = *(unsigned int *)RTA_DATA(rta);
} else if (rta->rta_type == RTA_MULTIPATH) {
- struct rtnexthop *rtnh;
+ const struct rtnexthop *rtnh;
rtnh = (struct rtnexthop *)RTA_DATA(rta);
ifi = rtnh->rtnh_ifindex;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] netlink: Use const rtnh pointer
2024-02-12 4:05 [PATCH] netlink: Use const rtnh pointer David Gibson
@ 2024-02-12 16:57 ` Stefano Brivio
2024-02-14 9:14 ` Stefano Brivio
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2024-02-12 16:57 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev
On Mon, 12 Feb 2024 15:05:28 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> 6c7623d07 ("netlink: Add support to fetch default gateway from multipath
> routes") inadvertently introduced a new cppcheck warning for a variable
> which could be a const pointer but isn't. This occurs with
> cppcheck-2.13.0-1.fc39.x86_64 in Fedora 39 at least.
Oops, sorry, I didn't switch to 2.13 yet. On the other hand it's
probably not bad that I lag a bit behind, so that we keep checking
things on two/three versions.
--
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] netlink: Use const rtnh pointer
2024-02-12 4:05 [PATCH] netlink: Use const rtnh pointer David Gibson
2024-02-12 16:57 ` Stefano Brivio
@ 2024-02-14 9:14 ` Stefano Brivio
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2024-02-14 9:14 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev
On Mon, 12 Feb 2024 15:05:28 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> 6c7623d07 ("netlink: Add support to fetch default gateway from multipath
> routes") inadvertently introduced a new cppcheck warning for a variable
> which could be a const pointer but isn't. This occurs with
> cppcheck-2.13.0-1.fc39.x86_64 in Fedora 39 at least.
>
> Fixes: 6c7623d07 ("netlink: Add support to fetch default gateway from multipath
> routes")
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
--
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-14 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 4:05 [PATCH] netlink: Use const rtnh pointer David Gibson
2024-02-12 16:57 ` Stefano Brivio
2024-02-14 9:14 ` Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).