From: Krzysztof Oledzki Date: Tue, 4 Mar 2008 22:56:23 +0000 (-0800) Subject: SCSI: mpt fusion: don't oops if NumPhys==0 X-Git-Tag: v2.6.24.4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=282dac698e338351d3b9fb9db2739fe07e1c2ef9;p=thirdparty%2Fkernel%2Fstable.git 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=9909 Signed-off-by: Krzysztof Piotr Oledzki Acked-by: Eric Moore Signed-off-by: Andrew Morton Signed-off-by: James Bottomley Signed-off-by: Chris Wright Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index e4c94f93de16a..c8d3ffb425be5 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1699,6 +1699,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, if (error) goto out_free_consistent; + if (!buffer->NumPhys) { + error = -ENODEV; + goto out_free_consistent; + } + /* save config data */ port_info->num_phys = buffer->NumPhys; port_info->phy_info = kcalloc(port_info->num_phys,