summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-04-22 17:08:09 (GMT)
committerThomas Haller <thaller@redhat.com>2022-04-22 17:08:10 (GMT)
commitfa79ee3615f871948e8cb6dfb941f40d860fe65f (patch)
tree5ca9ed28c9565c7f8fad91c410cce78ebf520dd4
parent31380f8b93ce3390e3aa32d593d56b0d05b3f73a (diff)
downloadlibnl-fa79ee3615f871948e8cb6dfb941f40d860fe65f.zip
libnl-fa79ee3615f871948e8cb6dfb941f40d860fe65f.tar.gz
libnl-fa79ee3615f871948e8cb6dfb941f40d860fe65f.tar.bz2
link/vrf: avoid coverity warning in rtnl_link_vrf_set_tableid() about CONSTANT_EXPRESSION_RESULT
Error: CONSTANT_EXPRESSION_RESULT (CWE-569): libnl-3.6.0/lib/route/link/vrf.c:237: result_independent_of_operands: "id > RT_TABLE_MAX" is always false regardless of the values of its operands. This occurs as the logical operand of "i # 235|··· # 236| IS_VRF_LINK_ASSERT(link); # 237|-> if(id > VRF_TABLE_ID_MAX) # 238| return -NLE_INVAL; # 239|···
-rw-r--r--lib/route/link/vrf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/route/link/vrf.c b/lib/route/link/vrf.c
index dc8d565..c4edd3e 100644
--- a/lib/route/link/vrf.c
+++ b/lib/route/link/vrf.c
@@ -233,8 +233,8 @@ int rtnl_link_vrf_set_tableid(struct rtnl_link *link, uint32_t id)
struct vrf_info *vi = link->l_info;
IS_VRF_LINK_ASSERT(link);
- if(id > VRF_TABLE_ID_MAX)
- return -NLE_INVAL;
+
+ _NL_STATIC_ASSERT(VRF_TABLE_ID_MAX == UINT32_MAX);
vi->table_id = id;
vi->vi_mask |= VRF_HAS_TABLE_ID;