Skip to content

Commit 43651df

Browse files
authored
CRC: Removed assertion on NULL buffer
When length is zero, the buffer is not accessed. The CRC functions are used inside several other layers where a 0-length buffer may have meanings in different contexts and being able to pass 0-length NULL buffers to CRC as a noop simplifies the code.
1 parent 683034d commit 43651df

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/MbedCRC.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ class MbedCRC {
415415
int32_t bitwise_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
416416
{
417417
MBED_ASSERT(crc != NULL);
418-
MBED_ASSERT(buffer != NULL);
419418

420419
const uint8_t *data = static_cast<const uint8_t *>(buffer);
421420
uint32_t p_crc = *crc;
@@ -460,7 +459,6 @@ class MbedCRC {
460459
int32_t table_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
461460
{
462461
MBED_ASSERT(crc != NULL);
463-
MBED_ASSERT(buffer != NULL);
464462

465463
const uint8_t *data = static_cast<const uint8_t *>(buffer);
466464
uint32_t p_crc = *crc;

0 commit comments

Comments
 (0)