Bluetooth: Mesh: Fixes pb-adv segment recv

Wrong use of function `find_msb_set(~link.rx.seg)`,
uint8_t type is implicitly converted to uint32_t.
As a result, it always returns 32 instead of the
expected value, resulting in abnormal processing
of prov segment.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2020-11-13 20:06:11 -08:00 committed by Johan Hedberg
parent 9cd34f8675
commit 65395f30ec

View file

@ -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;