public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [SCSI] scsi_transport_sas: check for allocation failure
@ 2013-03-08 12:02 Dan Carpenter
  2013-03-08 17:57 ` Douglas Gilbert
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2013-03-08 12:02 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel, kernel-janitors

Static checkers complain that this allocation isn't checked.  We
should return zero if the allocation fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 1b68142..a022997 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -379,9 +379,12 @@ sas_tlr_supported(struct scsi_device *sdev)
 {
 	const int vpd_len = 32;
 	struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
-	char *buffer = kzalloc(vpd_len, GFP_KERNEL);
+	char *buffer;
 	int ret = 0;
 
+	buffer = kzalloc(vpd_len, GFP_KERNEL);
+	if (!buffer)
+		goto out;
 	if (scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len))
 		goto out;
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-11 15:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 12:02 [patch] [SCSI] scsi_transport_sas: check for allocation failure Dan Carpenter
2013-03-08 17:57 ` Douglas Gilbert
2013-03-08 19:58   ` Dan Carpenter
2013-03-08 22:50   ` James Bottomley
2013-03-08 23:25     ` Douglas Gilbert
2013-03-11 13:10     ` Dan Carpenter
2013-03-11 14:48       ` Douglas Gilbert
2013-03-11 15:10         ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox