diff options
author | Carmine Scarpitta <cscarpit@cisco.com> | 2023-09-15 12:30:39 +0200 |
---|---|---|
committer | Carmine Scarpitta <cscarpit@cisco.com> | 2023-09-15 17:42:04 +0200 |
commit | 9de5b3bf58988b4ec5d663aaebda8906126ad29f (patch) | |
tree | 84ab00aeafffc7b15517ab186c85971d1f75dc94 | |
parent | isisd: Fix CID 1568132 (Null pointer dereference) (diff) | |
download | frr-9de5b3bf58988b4ec5d663aaebda8906126ad29f.tar.xz frr-9de5b3bf58988b4ec5d663aaebda8906126ad29f.zip |
isisd: Fix CID 1568133 (Null pointer dereference)
Null checking the `sra` pointer after dereferencing it causes a
coverity issue. Let's perform the null check before dereferencing the
pointer.
Fixes this coverity issue:
*** CID 1568133: Null pointer dereferences (REVERSE_INULL)
/isisd/isis_zebra.c: 1077 in isis_zebra_srv6_adj_sid_uninstall()
1071 enum seg6local_action_t action = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC;
1072 struct interface *ifp;
1073 uint16_t prefixlen = IPV6_MAX_BITLEN;
1074 struct isis_circuit *circuit = sra->adj->circuit;
1075 struct isis_area *area = circuit->area;
1076
>>> CID 1568133: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "sra" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1077 if (!sra)
1078 return;
1079
1080 switch (sra->behavior) {
1081 case SRV6_ENDPOINT_BEHAVIOR_END_X:
1082 prefixlen = IPV6_MAX_BITLEN;
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
-rw-r--r-- | isisd/isis_zebra.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 6b9507136..378d78efe 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -1074,12 +1074,15 @@ void isis_zebra_srv6_adj_sid_uninstall(struct srv6_adjacency *sra) enum seg6local_action_t action = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC; struct interface *ifp; uint16_t prefixlen = IPV6_MAX_BITLEN; - struct isis_circuit *circuit = sra->adj->circuit; - struct isis_area *area = circuit->area; + struct isis_circuit *circuit; + struct isis_area *area; if (!sra) return; + circuit = sra->adj->circuit; + area = circuit->area; + switch (sra->behavior) { case SRV6_ENDPOINT_BEHAVIOR_END_X: prefixlen = IPV6_MAX_BITLEN; |