Commit 51f39eae authored by Krzysztof Oledzki's avatar Krzysztof Oledzki Committed by James Bottomley

[SCSI] mpt fusion: don't oops if NumPhys==0

Don't oops if NumPhys==0, instead return -ENODEV.
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=9909Signed-off-by: default avatarKrzysztof Piotr Oledzki <ole@ans.pl>
Acked-by: default avatarEric Moore <Eric.Moore@lsi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 45ab33b6
...@@ -1701,6 +1701,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, ...@@ -1701,6 +1701,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
if (error) if (error)
goto out_free_consistent; goto out_free_consistent;
if (!buffer->NumPhys) {
error = -ENODEV;
goto out_free_consistent;
}
/* save config data */ /* save config data */
port_info->num_phys = buffer->NumPhys; port_info->num_phys = buffer->NumPhys;
port_info->phy_info = kcalloc(port_info->num_phys, port_info->phy_info = kcalloc(port_info->num_phys,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment