Hi,

Thanks for the report,

I will fix this in the coming days.

On Sat, Jun 4, 2022 at 10:08 AM Vitaly Chikunov <v...@altlinux.org> wrote:
>
> Stephane,
>
> There is compile failure on GCC 12.1.1:
>
>   pfmlib_perf_event_pmu.c: In function 'perf_table_alloc_event':
>   pfmlib_perf_event_pmu.c:293:47: error: pointer may be used after 'realloc' 
> [-Werror=use-after-free]
>     293 |         perf_pe_free = new_pe + (perf_pe_free - perf_pe);
>         |                                               ^
>   pfmlib_perf_event_pmu.c:289:18: note: call to 'realloc' here
>     289 |         new_pe = realloc(perf_pe, perf_pe_count * 
> sizeof(perf_event_t));
>         |                  
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   In function 'perf_table_alloc_umask',
>       inlined from 'gen_tracepoint_table' at pfmlib_perf_event_pmu.c:457:10:
>   pfmlib_perf_event_pmu.c:329:47: error: pointer may be used after 'realloc' 
> [-Werror=use-after-free]
>     329 |         perf_um_free = new_um + (perf_um_free - perf_um);
>         |                                               ^
>   pfmlib_perf_event_pmu.c:325:18: note: call to 'realloc' here
>     325 |         new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
>         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
>
> Also, pointer arithmetic on unallocated region are, perhaps, undefined
> behavior by C standard. So even though this math looks safe on x86 this
> should be fixed anyway to be more portable.
>
> Thanks,
>


_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to