linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH repost] aic94xx: sas_alloc_task
@ 2006-03-30 17:13 Mike Anderson
  0 siblings, 0 replies; only message in thread
From: Mike Anderson @ 2006-03-30 17:13 UTC (permalink / raw)
  To: linux-scsi

Check kmem_cache_alloc return prior to init of sas_task struct.

Signed-off-by: Mike Anderson <andmike@us.ibm.com>

 include/scsi/sas/sas_task.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_task.h	2006-03-28 09:19:29.000000000 -0800
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h	2006-03-30 08:46:06.000000000 -0800
@@ -212,12 +212,14 @@ static inline struct sas_task *sas_alloc
 	extern kmem_cache_t *sas_task_cache;
 	struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags);
 
-	memset(task, 0, sizeof(*task));
-	INIT_LIST_HEAD(&task->list);
-	spin_lock_init(&task->task_state_lock);
-	task->task_state_flags = SAS_TASK_STATE_PENDING;
-	init_timer(&task->timer);
-	init_completion(&task->completion);
+	if (task) {
+		memset(task, 0, sizeof(*task));
+		INIT_LIST_HEAD(&task->list);
+		spin_lock_init(&task->task_state_lock);
+		task->task_state_flags = SAS_TASK_STATE_PENDING;
+		init_timer(&task->timer);
+		init_completion(&task->completion);
+	}
 
 	return task;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-30 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-30 17:13 [PATCH repost] aic94xx: sas_alloc_task Mike Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).