In an unlikely (and probably wrong?) case that the 'ppi' parameter of ata_host_alloc_pinfo() points to an array starting with a NULL pointer, there's going to be a kernel oops as the 'pi' local variable won't get reassigned from the initial value of NULL. Assign &ata_dummy_port_info to 'pi' at the start of the *for* loop instead to fix this kernel oops for good... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx> --- This patch is against the 'for-next' branch of Damien's 'libata.git' repo. drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: libata/drivers/ata/libata-core.c =================================================================== --- libata.orig/drivers/ata/libata-core.c +++ libata/drivers/ata/libata-core.c @@ -5470,7 +5470,7 @@ struct ata_host *ata_host_alloc_pinfo(st if (!host) return NULL; - for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) { + for (i = 0, j = 0, pi = &ata_dummy_port_info; i < host->n_ports; i++) { struct ata_port *ap = host->ports[i]; if (ppi[j])