From: Mike Anderson <andmike@us.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH repost] aic94xx: sas_alloc_task
Date: Thu, 30 Mar 2006 09:13:32 -0800 [thread overview]
Message-ID: <20060330171332.GA32555@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: 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;
}
reply other threads:[~2006-03-30 17:41 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=20060330171332.GA32555@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 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).