* [PATCH] aic94xx: sas_alloc_task
@ 2006-03-06 8:30 Mike Anderson
0 siblings, 0 replies; only message in thread
From: Mike Anderson @ 2006-03-06 8:30 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: linux-2.6.9-patched/include/scsi/sas/sas_task.h
===================================================================
--- linux-2.6.9-patched.orig/include/scsi/sas/sas_task.h 2005-12-07 15:37:27.000000000 -0800
+++ linux-2.6.9-patched/include/scsi/sas/sas_task.h 2006-01-04 10:25:54.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-06 8:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-06 8:30 [PATCH] 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).