bluetooth: mesh: cfg_cli: Update logs when pulling out CDP0 and 1
This commits puts in order log messages when unpacking CDP0 and CDP1 so that it a bit more clear where the error happens. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
e2a0fafe42
commit
1eeee010bd
1 changed files with 7 additions and 1 deletions
|
@ -2275,6 +2275,7 @@ struct bt_mesh_comp_p0_elem *bt_mesh_comp_p0_elem_pull(const struct bt_mesh_comp
|
|||
size_t modlist_size;
|
||||
|
||||
if (page->_buf->len < 4) {
|
||||
LOG_DBG("Buffer is too short");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2285,6 +2286,7 @@ struct bt_mesh_comp_p0_elem *bt_mesh_comp_p0_elem_pull(const struct bt_mesh_comp
|
|||
modlist_size = elem->nsig * 2 + elem->nvnd * 4;
|
||||
|
||||
if (page->_buf->len < modlist_size) {
|
||||
LOG_DBG("Buffer is shorter than number of claimed models");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2321,7 +2323,7 @@ struct bt_mesh_comp_p1_elem *bt_mesh_comp_p1_elem_pull(struct net_buf_simple *bu
|
|||
struct bt_mesh_comp_p1_elem *elem)
|
||||
{
|
||||
if (buf->len < 4) {
|
||||
LOG_DBG("No more elements to pull or missing data");
|
||||
LOG_DBG("Buffer is too short");
|
||||
return NULL;
|
||||
}
|
||||
size_t elem_size = 0;
|
||||
|
@ -2333,6 +2335,7 @@ struct bt_mesh_comp_p1_elem *bt_mesh_comp_p1_elem_pull(struct net_buf_simple *bu
|
|||
elem->nvnd = net_buf_simple_pull_u8(buf);
|
||||
for (i = 0; i < elem->nsig + elem->nvnd; i++) {
|
||||
if (buf->len < elem_size + 1) {
|
||||
LOG_DBG("Buffer is shorter than number of claimed models");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2351,6 +2354,7 @@ struct bt_mesh_comp_p1_elem *bt_mesh_comp_p1_elem_pull(struct net_buf_simple *bu
|
|||
}
|
||||
|
||||
if (buf->len < elem_size) {
|
||||
LOG_DBG("No more elements to pull or missing data");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2381,6 +2385,7 @@ struct bt_mesh_comp_p1_model_item *bt_mesh_comp_p1_item_pull(
|
|||
item_size = item->ext_item_cnt * (item->format + 1);
|
||||
if (item->cor_present) {
|
||||
if (elem->_buf->len < 1) {
|
||||
LOG_DBG("Coresponding_Present field is claimed but not present");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2388,6 +2393,7 @@ struct bt_mesh_comp_p1_model_item *bt_mesh_comp_p1_item_pull(
|
|||
}
|
||||
|
||||
if (elem->_buf->len < item_size) {
|
||||
LOG_DBG("No more elements to pull or missing data");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue