Bluetooth: Coverity fix dereference before null check
https://scan9.scan.coverity.com/reports.htm#v45144/p12996/fileInstanceId=132890135&defectInstanceId=9972463&mergedDefectId=363710 Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
parent
34f78b8fde
commit
2dd987713b
1 changed files with 7 additions and 2 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <zephyr/sys/__assert.h>
|
||||||
#include <zephyr/sys/atomic.h>
|
#include <zephyr/sys/atomic.h>
|
||||||
#include <zephyr/sys/iterable_sections.h>
|
#include <zephyr/sys/iterable_sections.h>
|
||||||
#include <zephyr/sys/byteorder.h>
|
#include <zephyr/sys/byteorder.h>
|
||||||
|
@ -2031,9 +2032,13 @@ static int l2cap_chan_le_send_sdu(struct bt_l2cap_le_chan *ch,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
size_t sent = 0;
|
size_t sent = 0;
|
||||||
size_t rem_len = buf->len;
|
size_t rem_len;
|
||||||
|
|
||||||
while (buf && sent != rem_len) {
|
__ASSERT_NO_MSG(buf);
|
||||||
|
|
||||||
|
rem_len = buf->len;
|
||||||
|
|
||||||
|
while (sent != rem_len) {
|
||||||
ret = l2cap_chan_le_send(ch, buf, 0);
|
ret = l2cap_chan_le_send(ch, buf, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_DBG("failed to send buf (ch %p cid 0x%04x sent %d)",
|
LOG_DBG("failed to send buf (ch %p cid 0x%04x sent %d)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue