diff options
author | Stephen Worley <sworley@nvidia.com> | 2022-12-09 23:42:56 +0100 |
---|---|---|
committer | Stephen Worley <sworley@nvidia.com> | 2023-02-14 00:12:05 +0100 |
commit | 1dd3cd10b827c16d1a77ab4fb6cc56aff7b7a7be (patch) | |
tree | 25adb170bdc21802eb9fe91e9d8ebe612e6c239a /lib/mpls.h | |
parent | bgpd: SA set labels/num_labels to NULL/0 (diff) | |
download | frr-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.h | 4 |
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); |