Bluetooth: shell: Fix incorrect check for error return

This line was clearly intended to check for the value returned by
ad_init(). The ad_len is unsigned, so checking for a negative value
showed up in a recent Coverity run (no GitHub issue for it yet).

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
This commit is contained in:
Johan Hedberg 2024-04-27 10:30:51 +03:00 committed by Carles Cufí
parent 8c6e801250
commit ac804c6211

View file

@ -1866,7 +1866,7 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[])
atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_APPEARANCE, appearance);
err = ad_init(&ad[ad_len], ARRAY_SIZE(ad) - ad_len, adv_opt);
if (ad_len < 0) {
if (err < 0) {
return -ENOEXEC;
}
ad_len += err;