From 1f345f87f5d27a5f6f14765c564acced02e1cf27 Mon Sep 17 00:00:00 2001 From: Dipal M Zambare Date: Fri, 23 Sep 2022 14:31:45 +0530 Subject: [PATCH] Fixed ASAN reported issues in bli_l3_packm.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local_mem_s is allocated on stack but in the inner scop of the “if” block, however, it can be accessed through cntl_mem_p outside the if block. This error is flagged by address sanitizer. Fixed this issue by moving the variables declaration at the functions scope. This fix address the issue reported for follwoing libflame APIs geqp3, geqrf, gerq2, gerqf, gesvd, ggev, ggevx, potrf, potrs, stedc, steqr, syevd AMD-Internal: [CPUPL-2587] Change-Id: I63749c7d406c7339d2b45b0488108ccd3f90a248 --- frame/3/bli_l3_packm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frame/3/bli_l3_packm.c b/frame/3/bli_l3_packm.c index d6efb593c..149231330 100644 --- a/frame/3/bli_l3_packm.c +++ b/frame/3/bli_l3_packm.c @@ -47,6 +47,8 @@ void bli_l3_packm { packbuf_t pack_buf_type; mem_t* cntl_mem_p; + mem_t* local_mem_p; + mem_t local_mem_s; siz_t size_needed; // FGVZ: Not sure why we need this barrier, but we do. @@ -80,9 +82,6 @@ void bli_l3_packm // all threads in the chief's thread group. if ( bli_mem_is_unalloc( cntl_mem_p ) ) { - mem_t* local_mem_p; - mem_t local_mem_s; - if ( bli_thread_am_ochief( thread ) ) { #ifdef BLIS_ENABLE_MEM_TRACING @@ -110,9 +109,6 @@ void bli_l3_packm } else // ( bli_mem_is_alloc( cntl_mem_p ) ) { - mem_t* local_mem_p; - mem_t local_mem_s; - // If the mem_t entry in the control tree does NOT contain a NULL // buffer, then a block has already been acquired from the memory // broker and cached in the control tree.