[28/40] sim/ppc: Initialize stat type buffer

Message ID e2bbdb46be0d138a49751fb62d124b298acf758e.1666258361.git.research_trasio@irq.a4lg.com
State Committed
Commit 548d634f1b61571f118c3133ce0e8986714c8fd6
Headers
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Commit Message

Tsukasa OI Oct. 20, 2022, 9:32 a.m. UTC
  On do_fstat function, stat typed buffer buf is passed to write_buf function
uninitialized when fdbad(fd) is not zero.

This commit initializes the buffer with the default value.
---
 sim/ppc/emul_netbsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mike Frysinger Oct. 23, 2022, 3:06 p.m. UTC | #1
lgtm
-mike
  
Tsukasa OI Oct. 24, 2022, 11 a.m. UTC | #2
On 2022/10/24 0:06, Mike Frysinger wrote:
> lgtm
> -mike

I'll leave it for Andrew (PATCH 03/10) and I will withdraw following
patches from my patchset:

-   PATCH 03/40
-   PATCH 15/40
-   PATCH 16/40 (wrote by Andrew)
-   PATCH 28/40
-   PATCH 30/40
-   PATCH 36/40

Because this patchset (intended to be a RFC PATCH) is a mere copy of my
working branch, I need to sync with Andrew's work.

Thanks,
Tsukasa
  

Patch

diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index 072a5df5598..34ad86ccbe9 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -881,7 +881,7 @@  do_fstat(os_emul_data *emul,
 {
   int fd = cpu_registers(processor)->gpr[arg0];
   unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
-  struct stat buf;
+  struct stat buf = {};
   int status;
 #ifdef SYS_fstat
   SYS(fstat);