summaryrefslogtreecommitdiffstats
path: root/lib/mpls.h
diff options
context:
space:
mode:
authorStephen Worley <sworley@nvidia.com>2022-12-09 23:42:56 +0100
committerStephen Worley <sworley@nvidia.com>2023-02-14 00:12:05 +0100
commit1dd3cd10b827c16d1a77ab4fb6cc56aff7b7a7be (patch)
tree25adb170bdc21802eb9fe91e9d8ebe612e6c239a /lib/mpls.h
parentbgpd: SA set labels/num_labels to NULL/0 (diff)
downloadfrr-1dd3cd10b827c16d1a77ab4fb6cc56aff7b7a7be.tar.xz
frr-1dd3cd10b827c16d1a77ab4fb6cc56aff7b7a7be.zip
lib: add asserts to appease the SA
I don't believe label can be NULL in any calling path but SA thinks so so let's just assert here to be safe anyway and make it happy. Signed-off-by: Stephen Worley <sworley@nvidia.com>
Diffstat (limited to '')
-rw-r--r--lib/mpls.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/mpls.h b/lib/mpls.h
index f89d3246f..100d67e94 100644
--- a/lib/mpls.h
+++ b/lib/mpls.h
@@ -139,6 +139,8 @@ static inline void vni2label(vni_t vni, mpls_label_t *label)
{
uint8_t *tag = (uint8_t *)label;
+ assert(tag);
+
tag[0] = (vni >> 16) & 0xFF;
tag[1] = (vni >> 8) & 0xFF;
tag[2] = vni & 0xFF;
@@ -149,6 +151,8 @@ static inline vni_t label2vni(const mpls_label_t *label)
uint8_t *tag = (uint8_t *)label;
vni_t vni;
+ assert(tag);
+
vni = ((uint32_t)*tag++ << 16);
vni |= (uint32_t)*tag++ << 8;
vni |= (uint32_t)(*tag & 0xFF);