Skip to content

Commit

Permalink
Merge pull request #5982 from gilles-peskine-arm/selftest-calloc-poin…
Browse files Browse the repository at this point in the history
…ter-comparison-fix-2.28

Backport 2.28: Remove largely useless bit of test log to silence GCC 12
  • Loading branch information
daverodgman authored Jun 29, 2022
2 parents 06c5e92 + 52396ef commit eee5c8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.d/selftest-gcc12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bugfix
* Silence a warning from GCC 12 in the selftest program. Fixes #5974.
6 changes: 1 addition & 5 deletions programs/test/selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ static int calloc_self_test( int verbose )
void *empty2 = mbedtls_calloc( 0, 1 );
void *buffer1 = mbedtls_calloc( 1, 1 );
void *buffer2 = mbedtls_calloc( 1, 1 );
uintptr_t old_buffer1;

if( empty1 == NULL && empty2 == NULL )
{
Expand Down Expand Up @@ -131,7 +130,6 @@ static int calloc_self_test( int verbose )
mbedtls_printf( " CALLOC(1): passed\n" );
}

old_buffer1 = (uintptr_t) buffer1;
mbedtls_free( buffer1 );
buffer1 = mbedtls_calloc( 1, 1 );
if( buffer1 == NULL )
Expand All @@ -143,9 +141,7 @@ static int calloc_self_test( int verbose )
else
{
if( verbose )
mbedtls_printf( " CALLOC(1 again): passed (%s address)\n",
(uintptr_t) old_buffer1 == (uintptr_t) buffer1 ?
"same" : "different" );
mbedtls_printf( " CALLOC(1 again): passed\n" );
}

if( verbose )
Expand Down

0 comments on commit eee5c8a

Please sign in to comment.