* [patch] move dereference after null check
@ 2009-11-10 8:55 Dan Carpenter
2009-11-10 14:19 ` James Bottomley
0 siblings, 1 reply; 7+ 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] 7+ messages in thread
* Re: [patch] move dereference after null check
2009-11-10 8:55 Dan Carpenter
@ 2009-11-10 14:19 ` James Bottomley
0 siblings, 0 replies; 7+ 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] 7+ messages in thread
* [patch] move dereference after null check
@ 2009-11-16 9:06 Dan Carpenter
2009-11-16 10:36 ` Liam Girdwood
2009-11-16 16:11 ` Mark Brown
0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2009-11-16 9:06 UTC (permalink / raw)
To: alsa-devel; +Cc: broonie, lrg
The 'jack' variable was dereference before the NULL check so this patch
moves the dereference later.
regards,
dan carpenter
Signed-off-by: Dan Carpenter <error27@gmail.com>
--- orig/sound/soc/soc-jack.c 2009-11-14 11:04:04.000000000 +0200
+++ devel/sound/soc/soc-jack.c 2009-11-14 11:05:01.000000000 +0200
@@ -58,7 +58,7 @@
*/
void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
{
- struct snd_soc_codec *codec = jack->card->codec;
+ struct snd_soc_codec *codec;
struct snd_soc_jack_pin *pin;
int enable;
int oldstatus;
@@ -67,6 +67,7 @@
WARN_ON_ONCE(!jack);
return;
}
+ codec = jack->card->codec;
mutex_lock(&codec->mutex);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] move dereference after null check
2009-11-16 9:06 [patch] move dereference after null check Dan Carpenter
@ 2009-11-16 10:36 ` Liam Girdwood
2009-11-16 16:11 ` Mark Brown
1 sibling, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2009-11-16 10:36 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel, broonie
On Mon, 2009-11-16 at 11:06 +0200, Dan Carpenter wrote:
> The 'jack' variable was dereference before the NULL check so this patch
> moves the dereference later.
>
> regards,
> dan carpenter
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
>
> --- orig/sound/soc/soc-jack.c 2009-11-14 11:04:04.000000000 +0200
> +++ devel/sound/soc/soc-jack.c 2009-11-14 11:05:01.000000000 +0200
> @@ -58,7 +58,7 @@
> */
> void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
> {
> - struct snd_soc_codec *codec = jack->card->codec;
> + struct snd_soc_codec *codec;
> struct snd_soc_jack_pin *pin;
> int enable;
> int oldstatus;
> @@ -67,6 +67,7 @@
> WARN_ON_ONCE(!jack);
> return;
> }
> + codec = jack->card->codec;
>
> mutex_lock(&codec->mutex);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] move dereference after null check
2009-11-16 9:06 [patch] move dereference after null check Dan Carpenter
2009-11-16 10:36 ` Liam Girdwood
@ 2009-11-16 16:11 ` Mark Brown
2009-11-16 16:15 ` Takashi Iwai
2009-11-18 8:45 ` Dan Carpenter
1 sibling, 2 replies; 7+ messages in thread
From: Mark Brown @ 2009-11-16 16:11 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel, lrg
On Mon, Nov 16, 2009 at 11:06:33AM +0200, Dan Carpenter wrote:
> The 'jack' variable was dereference before the NULL check so this patch
> moves the dereference later.
>
> regards,
> dan carpenter
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
This does not apply to the current ASoC code, it appears that someone
else has already provided an equivalent change. When doing work like
this it's normally best to work against -next to help avoid duplication
such as this.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] move dereference after null check
2009-11-16 16:11 ` Mark Brown
@ 2009-11-16 16:15 ` Takashi Iwai
2009-11-18 8:45 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2009-11-16 16:15 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Dan Carpenter, lrg
At Mon, 16 Nov 2009 16:11:24 +0000,
Mark Brown wrote:
>
> On Mon, Nov 16, 2009 at 11:06:33AM +0200, Dan Carpenter wrote:
> > The 'jack' variable was dereference before the NULL check so this patch
> > moves the dereference later.
> >
> > regards,
> > dan carpenter
> >
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> This does not apply to the current ASoC code, it appears that someone
> else has already provided an equivalent change. When doing work like
> this it's normally best to work against -next to help avoid duplication
> such as this.
Yep. FYI, it's the commit below:
commit 4f066173fe8deb8874f41917e5d26ea2e0c46e3b
Author: Julia Lawall <julia@diku.dk>
Date: Sat Oct 17 08:32:56 2009 +0200
ASoC: Move dereference after NULL test
thanks,
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] move dereference after null check
2009-11-16 16:11 ` Mark Brown
2009-11-16 16:15 ` Takashi Iwai
@ 2009-11-18 8:45 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2009-11-18 8:45 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Dan Carpenter, lrg
Sorry about that.
I wish I could but until I get broadband, or git gets a restartable clone
I can't use it for kernel development. The kernel archive is too big to
download in one shot.
Right now I pay $20 and I can use wifi for a week but it's capped out at
200MB. Fortunately, I'm likely to get broadband soon. I'll pay $156 per
month and it's capped at 200MB during business hours and "unlimitted" on
nights and weekends. Woohoo!
regards,
dan carpenter
On Mon, 16 Nov 2009, Mark Brown wrote:
> On Mon, Nov 16, 2009 at 11:06:33AM +0200, Dan Carpenter wrote:
> > The 'jack' variable was dereference before the NULL check so this patch
> > moves the dereference later.
> >
> > regards,
> > dan carpenter
> >
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> This does not apply to the current ASoC code, it appears that someone
> else has already provided an equivalent change. When doing work like
> this it's normally best to work against -next to help avoid duplication
> such as this.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-18 8:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 9:06 [patch] move dereference after null check Dan Carpenter
2009-11-16 10:36 ` Liam Girdwood
2009-11-16 16:11 ` Mark Brown
2009-11-16 16:15 ` Takashi Iwai
2009-11-18 8:45 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2009-11-10 8:55 Dan Carpenter
2009-11-10 14:19 ` James Bottomley
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.