From: Anton Moryakov <ant.v.moryakov@gmail.com>
To: netdev@vger.kernel.org
Cc: Anton Moryakov <ant.v.moryakov@gmail.com>
Subject: [PATCH iproute2-next] ip: check return value of iproute_flush_cache() in irpoute.c
Date: Mon, 17 Feb 2025 19:21:50 +0300 [thread overview]
Message-ID: <20250217162153.838113-1-ant.v.moryakov@gmail.com> (raw)
Static analyzer reported:
Return value of function 'iproute_flush_cache', called at iproute.c:1732,
is not checked. The return value is obtained from function 'open64' and possibly contains an error code.
Corrections explained:
The function iproute_flush_cache() may return an error code, which was
previously ignored. This could lead to unexpected behavior if the cache
flush fails. Added error handling to ensure the function fails gracefully
when iproute_flush_cache() returns an error.
Triggers found by static analyzer Svace.
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
---
ip/iproute.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index e1fe26ce..64e7d77e 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1729,7 +1729,10 @@ static int iproute_flush(int family, rtnl_filter_t filter_fn)
if (filter.cloned) {
if (family != AF_INET6) {
- iproute_flush_cache();
+ ret = iproute_flush_cache();
+ if(ret < 0)
+ return ret;
+
if (show_stats)
printf("*** IPv4 routing cache is flushed.\n");
}
--
2.30.2
next reply other threads:[~2025-02-17 16:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 16:21 Anton Moryakov [this message]
2025-02-17 16:21 ` [PATCH iproute2-next] ip: handle NULL return from localtime in strxf_time in Anton Moryakov
2025-02-17 16:21 ` [PATCH iproute2-next] ip: remove duplicate condition in ila_csum_name2mode in Anton Moryakov
2025-02-17 16:21 ` [PATCH iproute2-next] lib: remove redundant checks in get_u64 and get_s64 Anton Moryakov
2025-02-19 15:54 ` [PATCH iproute2-next] ip: check return value of iproute_flush_cache() in irpoute.c David Ahern
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=20250217162153.838113-1-ant.v.moryakov@gmail.com \
--to=ant.v.moryakov@gmail.com \
--cc=netdev@vger.kernel.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.