diff options
| author | Stephen Worley <sworley@nvidia.com> | 2022-12-09 17:42:56 -0500 |
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2023-02-13 18:12:05 -0500 |
| commit | 1dd3cd10b827c16d1a77ab4fb6cc56aff7b7a7be (patch) | |
| tree | 25adb170bdc21802eb9fe91e9d8ebe612e6c239a /lib/mpls.h | |
| parent | 5313cd675885ec0f8fcc201c539b2920eeb5c5fa (diff) | |
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 'lib/mpls.h')
| -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 f89d3246ff..100d67e94b 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); |
