[PATCH 12/14] fix potential dereference of NULL in is_cyclic_region()
Found with -fanalyzer
In file included from sadump_info.c:21:
makedumpfile.h: In function ‘is_dumpable_buffer’:
makedumpfile.h:2314:24: warning: dereference of NULL ‘cycle’ [CWE-476] [-Wanalyzer-null-dereference]
2314 | if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn)
| ~~~~~^~~~~~~~~~~
...
‘sadump_initialize_bitmap_memory’: events 12-14
|
| 891 | pfn < (section + 1) * SADUMP_PF_SECTION_NUM;
| 892 | ++pfn)
| 893 | if (is_dumpable(bmp, pfn, NULL))
| | ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (14) calling ‘is_dumpable’ from ‘sadump_initialize_bitmap_memory’
| | (13) ...to here
|
+--> ‘is_dumpable’: events 15-18
|
|makedumpfile.h:2355:1:
| 2355 | is_dumpable(struct dump_bitmap *bitmap, mdf_pfn_t pfn, struct cycle *cycle)
| | ^~~~~~~~~~~
| | |
| | (15) entry to ‘is_dumpable’
| 2356 | {
| 2357 | if (bitmap->fd < 0) {
| | ~
| | |
| | (16) following ‘true’ branch...
| 2358 | return is_dumpable_buffer(bitmap, pfn, cycle);
| | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | |
| | | (18) calling ‘is_dumpable_buffer’ from ‘is_dumpable’
| | (17) ...to here
|
+--> ‘is_dumpable_buffer’: events 19-20
|
| 2314 | if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn)
| | ~~~~~~~~~~~~~~~~
| | |
| | (20) dereference of NULL ‘cycle’
|......
| 2321 | is_dumpable_buffer(struct dump_bitmap *bitmap, mdf_pfn_t pfn, struct cycle *cycle)
| | ^~~~~~~~~~~~~~~~~~
| | |
| | (19) entry to ‘is_dumpable_buffer’
|
Signed-off-by:
Philipp Rudo <prudo@redhat.com>
Loading
Please sign in to comment