From: Mike Anderson <andmike@us.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] aic94xx: sas_alloc_task
Date: Mon, 6 Mar 2006 00:30:25 -0800 [thread overview]
Message-ID: <20060306083025.GA27811@us.ibm.com> (raw)
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;
}
reply other threads:[~2006-03-06 8:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060306083025.GA27811@us.ibm.com \
--to=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.