* [patch] move dereference after null check
@ 2009-11-10 8:55 Dan Carpenter
2009-11-10 14:19 ` James Bottomley
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2009-11-10 8:55 UTC (permalink / raw)
To: linux-ide; +Cc: davem
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) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] move dereference after null check
2009-11-10 8:55 [patch] move dereference after null check Dan Carpenter
@ 2009-11-10 14:19 ` James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2009-11-10 14:19 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-ide, davem
On Tue, 2009-11-10 at 10:55 +0200, Dan Carpenter wrote:
> 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;
There's no problem here: this isn't a dereference.
James
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-10 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 8:55 [patch] move dereference after null check Dan Carpenter
2009-11-10 14:19 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox