From: Dan Carpenter <error27@gmail.com>
To: linux-ide@vger.kernel.org
Cc: davem@davemloft.net
Subject: [patch] move dereference after null check
Date: Tue, 10 Nov 2009 10:55:43 +0200 (SAST) [thread overview]
Message-ID: <alpine.DEB.2.00.0911081949070.11108@bicker> (raw)
I moved the ops->inherits dereference below the null check. I moved the
other assignment as well so that they would be together.
Found by smatch static checker.
regards,
dan carpenter
Signed-off-by: Dan Carpenter <error27@gmail.com>
--- orig/drivers/ata/libata-core.c 2009-11-08 19:40:18.000000000 +0200
+++ devel/drivers/ata/libata-core.c 2009-11-08 19:42:06.000000000 +0200
@@ -5938,13 +5938,14 @@
{
static DEFINE_SPINLOCK(lock);
const struct ata_port_operations *cur;
- void **begin = (void **)ops;
- void **end = (void **)&ops->inherits;
- void **pp;
+ void **begin, **end, **pp;
if (!ops || !ops->inherits)
return;
+ begin = (void **)ops;
+ end = (void **)&ops->inherits;
+
spin_lock(&lock);
for (cur = ops->inherits; cur; cur = cur->inherits) {
next reply other threads:[~2009-11-10 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 8:55 Dan Carpenter [this message]
2009-11-10 14:19 ` [patch] move dereference after null check James Bottomley
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=alpine.DEB.2.00.0911081949070.11108@bicker \
--to=error27@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-ide@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