public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH] netlink: Use const rtnh pointer
Date: Mon, 12 Feb 2024 15:05:28 +1100	[thread overview]
Message-ID: <20240212040528.144416-1-david@gibson.dropbear.id.au> (raw)

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


             reply	other threads:[~2024-02-12  4:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  4:05 David Gibson [this message]
2024-02-12 16:57 ` [PATCH] netlink: Use const rtnh pointer Stefano Brivio
2024-02-14  9:14 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240212040528.144416-1-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).