diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index 3354910dfa..8034ad38a6 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -460,7 +460,7 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf) link.rx.last_seg = START_LAST_SEG(rx->gpc); if ((link.rx.seg & BIT(0)) && - (find_msb_set(~link.rx.seg) >= link.rx.last_seg)) { + (find_msb_set((~link.rx.seg) & SEG_NVAL) - 1 > link.rx.last_seg)) { BT_ERR("Invalid segment index %u", seg); prov_failed(PROV_ERR_NVAL_FMT); return;