From: Dan Carpenter <dan.carpenter@oracle.com>
To: Aaron Lu <aaron.lu@intel.com>
Cc: Jeff Garzik <jgarzik@redhat.com>,
linux-ide@vger.kernel.org, kbuild@01.org
Subject: Re: [libata:upstream 7/11] drivers/ata/libata-zpodd.c:83 zpodd_wake_dev() warn: variable dereferenced before check 'ata_dev' (see line 80)
Date: Tue, 22 Jan 2013 11:38:12 +0300 [thread overview]
Message-ID: <20130122083812.GC16282@mwanda> (raw)
In-Reply-To: <50FE4E86.5090308@intel.com>
On Tue, Jan 22, 2013 at 04:32:06PM +0800, Aaron Lu wrote:
> Hi Dan,
>
> Thanks for the remind.
>
> On 01/22/2013 02:25 PM, Dan Carpenter wrote:
> > Hi Aaron,
> >
> > FYI, there are new smatch warnings show up in
> >
> > tree: git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream
> > head: 7e15e9be37eb834aaaca69030064ac97eaf5df2f
> > commit: f064a20dded807448669426c9bfb7d03aba5659c [7/11] libata: move acpi notification code to zpodd
> >
> > New smatch warnings:
> > drivers/ata/libata-zpodd.c:83 zpodd_wake_dev() warn: variable dereferenced before check 'ata_dev' (see line 80)
>
> The ata_dev variable shouldn't ever be NULL here.
>
> >
> > git remote add libata git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
> > git remote update libata
> > git checkout f064a20dded807448669426c9bfb7d03aba5659c
> > vim +/ata_dev +83 drivers/ata/libata-zpodd.c
> >
> > afe75951 Aaron Lu 2013-01-15 74 return acpi_device_can_poweroff(acpi_dev);
> > afe75951 Aaron Lu 2013-01-15 75 }
> > afe75951 Aaron Lu 2013-01-15 76
> > f064a20d Aaron Lu 2013-01-15 77 static void zpodd_wake_dev(acpi_handle handle, u32 event, void *context)
> > f064a20d Aaron Lu 2013-01-15 78 {
> > f064a20d Aaron Lu 2013-01-15 79 struct ata_device *ata_dev = context;
> > f064a20d Aaron Lu 2013-01-15 @80 struct zpodd *zpodd = ata_dev->zpodd;
> > f064a20d Aaron Lu 2013-01-15 81 struct device *dev = &ata_dev->sdev->sdev_gendev;
> > f064a20d Aaron Lu 2013-01-15 82
> > f064a20d Aaron Lu 2013-01-15 @83 if (event == ACPI_NOTIFY_DEVICE_WAKE && ata_dev &&
>
> If I remove the check for ata_dev here, will the smatch warning go away?
> Or should I add a check above? I suppose we need to do something to the
> warning, so that it won't pop up in the future, so please feel free to
> suggest, thanks!
Removing the check would silence the warning.
regards,
dan carpenter
next prev parent reply other threads:[~2013-01-22 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 6:25 [libata:upstream 7/11] drivers/ata/libata-zpodd.c:83 zpodd_wake_dev() warn: variable dereferenced before check 'ata_dev' (see line 80) Dan Carpenter
2013-01-22 8:32 ` Aaron Lu
2013-01-22 8:38 ` Dan Carpenter [this message]
2013-01-22 8:45 ` Aaron Lu
2013-01-25 20:38 ` Jeff Garzik
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=20130122083812.GC16282@mwanda \
--to=dan.carpenter@oracle.com \
--cc=aaron.lu@intel.com \
--cc=jgarzik@redhat.com \
--cc=kbuild@01.org \
--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 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.