[20/21] sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Fix warn unused result

Message ID 20230620181910.1506893-21-fberat@redhat.com
State Committed
Commit d636339306d19beb486d6f3a0b364db845baf4e0
Headers
Series Allow glibc to be built with _FORTIFY_SOURCE |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 fail Testing failed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm fail Testing failed

Commit Message

Frederic Berat June 20, 2023, 6:19 p.m. UTC
  The fread routine return value needs to be checked when fortification
is enabled, hence use xfread helper.
---
 sysdeps/powerpc/fpu/tst-setcontext-fpscr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar June 21, 2023, 11:45 a.m. UTC | #1
On 2023-06-20 14:19, Frédéric Bérat wrote:
> The fread routine return value needs to be checked when fortification
> is enabled, hence use xfread helper.
> ---

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

>   sysdeps/powerpc/fpu/tst-setcontext-fpscr.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
> index 2fd8838bbe..2eba5f2672 100644
> --- a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
> +++ b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
> @@ -27,6 +27,8 @@
>   #include <sys/auxv.h>
>   #include <support/support.h>
>   
> +#include <support/xstdio.h>
> +
>   static ucontext_t ctx[3];
>   
>   
> @@ -61,7 +63,7 @@ ElfW(Addr) query_auxv(int type)
>   
>         do
>   	{
> -	  fread (&auxv_struct, sizeof (ElfW(auxv_t)), 1, auxv_f);
> +	  xfread (&auxv_struct, sizeof (ElfW(auxv_t)), 1, auxv_f);
>   	  auxv[i] = auxv_struct;
>   	  i++;
>   	} while(auxv_struct.a_type != AT_NULL);
  

Patch

diff --git a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
index 2fd8838bbe..2eba5f2672 100644
--- a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
+++ b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
@@ -27,6 +27,8 @@ 
 #include <sys/auxv.h>
 #include <support/support.h>
 
+#include <support/xstdio.h>
+
 static ucontext_t ctx[3];
 
 
@@ -61,7 +63,7 @@  ElfW(Addr) query_auxv(int type)
 
       do
 	{
-	  fread (&auxv_struct, sizeof (ElfW(auxv_t)), 1, auxv_f);
+	  xfread (&auxv_struct, sizeof (ElfW(auxv_t)), 1, auxv_f);
 	  auxv[i] = auxv_struct;
 	  i++;
 	} while(auxv_struct.a_type != AT_NULL);