ahci: zero-initialize port struct

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>
This commit is contained in:
Gerd Hoffmann 2019-11-13 10:13:02 +01:00
parent 9caa19be0e
commit 3bdd2b7765
1 changed files with 1 additions and 0 deletions

View 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);