1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #11321 from bergzand/pr/mrf24j40/fix_empty_element

drivers/mrf24j40: don't load data if iol->iol_len == 0
This commit is contained in:
MichelRottleuthner 2019-04-01 17:09:15 +02:00 committed by GitHub
commit d77b8e1f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,13 +71,17 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
/* load packet data into FIFO */
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
/* current packet data + FCS too long */
if ((len + iol->iol_len + 2) > IEEE802154_FRAME_LEN_MAX) {
DEBUG("[mrf24j40] error: packet too large (%u byte) to be send\n",
(unsigned)len + 2);
return -EOVERFLOW;
/* Check if there is data to copy, prevents assertion failure in the
* SPI peripheral if there is no data to copy */
if (iol->iol_len) {
/* current packet data + FCS too long */
if ((len + iol->iol_len + 2) > IEEE802154_FRAME_LEN_MAX) {
DEBUG("[mrf24j40] error: packet too large (%u byte) to be send\n",
(unsigned)len + 2);
return -EOVERFLOW;
}
len = mrf24j40_tx_load(dev, iol->iol_base, iol->iol_len, len);
}
len = mrf24j40_tx_load(dev, iol->iol_base, iol->iol_len, len);
/* only on first iteration: */
if (iol == iolist) {
dev->header_len = len;