From 6af92ee113bf3eadef843aea31c0fa354c99dd98 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 3 Aug 2020 11:33:56 +0200 Subject: [PATCH] gnrc/nib: fix _idx_dsts() calculation Using pointer difference already gives us the number of elements of size of what the pointer is pointing to. Dividing by size will lead to the wrong (always 0) result. --- sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c index 7bcd2e86ed..bacd4f907e 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c @@ -527,7 +527,7 @@ static inline bool _in_dsts(const _nib_offl_entry_t *dst) #if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C) static inline unsigned _idx_dsts(const _nib_offl_entry_t *dst) { - return (dst - _dsts) / sizeof(*dst); + return (dst - _dsts); } static inline bool _in_abrs(const _nib_abr_entry_t *abr)