mirror of
https://github.com/eclipse/upm.git
synced 2025-07-12 14:51:12 +03:00
rf22: Static analysis fixes
A few small fixes for the rf22 to satisfy klocwork. * Converted malloc's to new's to be more C++'ish and since malloc return were not checked. * Initialize data, buf, and _lastInterruptFlags * Up'ed RF22_MAX_MESSAGE_LEN to 64. Reason: void RF22::sendNextFragment() { if (_txBufSentIndex < _bufLen) { // Some left to send? uint8_t len = _bufLen - _txBufSentIndex; // But dont send too much if (len > (RF22_FIFO_SIZE - RF22_TXFFAEM_THRESHOLD - 1)) len = (RF22_FIFO_SIZE - RF22_TXFFAEM_THRESHOLD - 1); spiBurstWrite(RF22_REG_7F_FIFO_ACCESS, _buf + _txBufSentIndex, len); _txBufSentIndex += len; } } RF22_FIFO_SIZE = 64 RF22_TXFFAEM_THRESHOLD = 4 RF22_MAX_MESSAGE_LEN = 50 _buf[RF22_MAX_MESSAGE_LEN] Length of _buf *was* 50, so if the 'But dont send too much' above was to happen, the length is set to 63, which overruns _buf[RF22_MAX_MESSAGE_LEN] Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -41,7 +41,7 @@
|
||||
// Can be pre-defined to a smaller size (to save SRAM) prior to including this header
|
||||
#ifndef RF22_MAX_MESSAGE_LEN
|
||||
//#define RF22_MAX_MESSAGE_LEN 255
|
||||
#define RF22_MAX_MESSAGE_LEN 50
|
||||
#define RF22_MAX_MESSAGE_LEN 64
|
||||
#endif
|
||||
|
||||
// Max number of octets the RF22 Rx and Tx FIFOs can hold
|
||||
|
Reference in New Issue
Block a user