mirror of
https://github.com/espressif/esp-idf
synced 2025-03-12 10:39:11 -04:00
Merge branch 'bugfix/esp_ringbuf_static_analyzer_v5.3' into 'release/v5.3'
fix(ringbuf): fixed logic errors when compiling with CONFIG_COMPILER_STATIC_ANALYZER (v5.3) See merge request espressif/esp-idf!35301
This commit is contained in:
commit
f53b071b51
@ -831,7 +831,7 @@ static BaseType_t prvReceiveGeneric(Ringbuffer_t *pxRingbuffer,
|
||||
|
||||
#ifdef __clang_analyzer__
|
||||
// Teach clang-tidy that if NULL pointers are provided, this function will never dereference them
|
||||
if (!pvItem1 || !pvItem2 || !xItemSize1 || !xItemSize2) {
|
||||
if (!pvItem1 || !xItemSize1) {
|
||||
return pdFALSE;
|
||||
}
|
||||
#endif /*__clang_analyzer__ */
|
||||
@ -850,6 +850,12 @@ static BaseType_t prvReceiveGeneric(Ringbuffer_t *pxRingbuffer,
|
||||
}
|
||||
//If split buffer, check for split items
|
||||
if (pxRingbuffer->uxRingbufferFlags & rbALLOW_SPLIT_FLAG) {
|
||||
#ifdef __clang_analyzer__
|
||||
// Teach clang-tidy that if NULL pointers are provided, this function will never dereference them
|
||||
if (!pvItem2 || !xItemSize2) {
|
||||
return pdFALSE;
|
||||
}
|
||||
#endif /*__clang_analyzer__ */
|
||||
if (xIsSplit == pdTRUE) {
|
||||
*pvItem2 = pxRingbuffer->pvGetItem(pxRingbuffer, &xIsSplit, 0, xItemSize2);
|
||||
configASSERT(*pvItem2 < *pvItem1); //Check wrap around has occurred
|
||||
@ -897,7 +903,7 @@ static BaseType_t prvReceiveGenericFromISR(Ringbuffer_t *pxRingbuffer,
|
||||
|
||||
#ifdef __clang_analyzer__
|
||||
// Teach clang-tidy that if NULL pointers are provided, this function will never dereference them
|
||||
if (!pvItem1 || !pvItem2 || !xItemSize1 || !xItemSize2) {
|
||||
if (!pvItem1 || !xItemSize1) {
|
||||
return pdFALSE;
|
||||
}
|
||||
#endif /*__clang_analyzer__ */
|
||||
@ -914,6 +920,12 @@ static BaseType_t prvReceiveGenericFromISR(Ringbuffer_t *pxRingbuffer,
|
||||
}
|
||||
//If split buffer, check for split items
|
||||
if (pxRingbuffer->uxRingbufferFlags & rbALLOW_SPLIT_FLAG) {
|
||||
#ifdef __clang_analyzer__
|
||||
// Teach clang-tidy that if NULL pointers are provided, this function will never dereference them
|
||||
if (!pvItem2 || !xItemSize2) {
|
||||
return pdFALSE;
|
||||
}
|
||||
#endif /*__clang_analyzer__ */
|
||||
if (xIsSplit == pdTRUE) {
|
||||
*pvItem2 = pxRingbuffer->pvGetItem(pxRingbuffer, &xIsSplit, 0, xItemSize2);
|
||||
configASSERT(*pvItem2 < *pvItem1); //Check wrap around has occurred
|
||||
|
Loading…
x
Reference in New Issue
Block a user