Skip to content

Commit

Permalink
Bluetooth: shell: Fix missing check for buffer allocation
Browse files Browse the repository at this point in the history
In practice this allocation is very unlikely to fail, however being
consistent with checking for a failure keeps Coverity happy.

Signed-off-by: Johan Hedberg <[email protected]>
  • Loading branch information
jhedberg authored and nashif committed Jun 26, 2024
1 parent de2efde commit 63d97c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions subsys/bluetooth/shell/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,11 @@ static int cmd_hci_cmd(const struct shell *sh, size_t argc, char *argv[])
}

buf = bt_hci_cmd_create(BT_OP(ogf, ocf), len);
if (buf == NULL) {
shell_error(sh, "Unable to allocate HCI buffer");
return -ENOMEM;
}

net_buf_add_mem(buf, hex_data, len);
}

Expand Down

0 comments on commit 63d97c1

Please sign in to comment.