From: Roel Kluin <roel.kluin@xxxxxxxxx> kmalloc() may fail, so test whether it succeeded. Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Cc: Wei Yongjun <yjwei@xxxxxxxxxxxxxx> Cc: Mike Christie <michaelc@xxxxxxxxxxx> Cc: Boaz Harrosh <bharrosh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/scsi/scsi.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN drivers/scsi/scsi.c~zfcp-test-kmalloc-failure-in-scsi_get_vpd_page drivers/scsi/scsi.c --- a/drivers/scsi/scsi.c~zfcp-test-kmalloc-failure-in-scsi_get_vpd_page +++ a/drivers/scsi/scsi.c @@ -1066,6 +1066,8 @@ unsigned char *scsi_get_vpd_page(struct kfree(buf); buf = kmalloc(len, GFP_KERNEL); + if (!buf) + return NULL; result = scsi_vpd_inquiry(sdev, buf, page, len); if (result) goto fail; _ -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html