]> xenbits.xensource.com Git - seabios.git/commitdiff
ahci: zero-initialize port struct
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 13 Nov 2019 09:13:02 +0000 (10:13 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 13 Nov 2019 13:59:39 +0000 (14:59 +0100)
Specifically port->drive.lchs needs clearing, otherwise seabios will
try interpret whatever random crap happens to be there as disk geometry,
which may or may not break boot depending on how lucky you are.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
src/hw/ahci.c

index 97a072a1ca81604aff7a58c51da2ff789bac8c0c..d45b4307ec687245e3dd02b206516863f63e9398 100644 (file)
@@ -345,6 +345,7 @@ ahci_port_alloc(struct ahci_ctrl_s *ctrl, u32 pnr)
         warn_noalloc();
         return NULL;
     }
+    memset(port, 0, sizeof(*port));
     port->pnr = pnr;
     port->ctrl = ctrl;
     port->list = memalign_tmp(1024, 1024);