mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #6185 from smlng/pr/gnrc_pktbuf/add_asserts
gnrc_pktbuf: add asserts to fix static analyzer error
This commit is contained in:
commit
bdd7d64408
@ -191,6 +191,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt);
|
|||||||
/**
|
/**
|
||||||
* @brief Create a IOVEC representation of the packet pointed to by *pkt*
|
* @brief Create a IOVEC representation of the packet pointed to by *pkt*
|
||||||
*
|
*
|
||||||
|
* @pre `(len != NULL)`
|
||||||
|
*
|
||||||
* @details This function will create a new packet snip in the packet buffer,
|
* @details This function will create a new packet snip in the packet buffer,
|
||||||
* which points to the given *pkt* and contains a IOVEC representation
|
* which points to the given *pkt* and contains a IOVEC representation
|
||||||
* of the referenced packet in its data section.
|
* of the referenced packet in its data section.
|
||||||
|
@ -276,6 +276,7 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
|
|||||||
gnrc_pktsnip_t *head;
|
gnrc_pktsnip_t *head;
|
||||||
struct iovec *vec;
|
struct iovec *vec;
|
||||||
|
|
||||||
|
assert(len != NULL);
|
||||||
if (pkt == NULL) {
|
if (pkt == NULL) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -289,6 +290,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
|
|||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(head->data != NULL);
|
||||||
vec = (struct iovec *)(head->data);
|
vec = (struct iovec *)(head->data);
|
||||||
/* fill the IOVEC */
|
/* fill the IOVEC */
|
||||||
while (pkt != NULL) {
|
while (pkt != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user