]> www.infradead.org Git - users/borneoa/openocd-next.git/commit
list: silent scan-build false positive
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 5 Apr 2025 15:04:43 +0000 (17:04 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 19 Apr 2025 09:18:36 +0000 (09:18 +0000)
commitcfed1f78db635b504e4d11da537e614adfd57d3f
tree0ab18484c6235120880cdaa8f253d4c20d3ab85b
parent16c5c1b353b06602d81a8a81f5243154a6c366cc
list: silent scan-build false positive

With commit c023534e7b6f ("target: use list for target events")
scan build incorrectly states that list_add() would be called with
the field 'next' of the parameter 'head' (thus 'head->next') set
to NULL. Then, list_add() would call linux_list_add() with the
parameter 'next' set to NULL that will cause a NULL dereference.

While this can really happen with broken code, it's not the case
with the code from the change above.

Add assert() in linux_list_add() to silent scan build on this
false positive and to detect future incorrect use of the list.

Change-Id: Iec7f3d70237312b646ac58f76ecaab2fa25eab41
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8824
Tested-by: jenkins
src/helper/list.h