From: Krzysztof Oledzki 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 Cc: FUJITA Tomonori Cc: James Bottomley Cc: Eric Moore Cc: Sathya Prakash Signed-off-by: Andrew Morton --- drivers/message/fusion/mptsas.c | 5 +++++ 1 file changed, 5 insertions(+) diff -puN drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 drivers/message/fusion/mptsas.c --- a/drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 +++ a/drivers/message/fusion/mptsas.c @@ -1701,6 +1701,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc 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, _