qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Gabriel L. Somlo" <somlo@cmu.edu>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [Qemu-devel] [patch] firmware: qemu_fw_cfg.c: potential unintialized variable
Date: Thu, 14 Apr 2016 22:12:53 +0300	[thread overview]
Message-ID: <20160414191253.GH4247@mwanda> (raw)
In-Reply-To: <20160414184005.GC7821@HEDWIG.INI.CMU.EDU>

On Thu, Apr 14, 2016 at 02:40:06PM -0400, Gabriel L. Somlo wrote:
> On Thu, Apr 14, 2016 at 12:33:37PM +0300, Dan Carpenter wrote:
> > It acpi_acquire_global_lock() return AE_NOT_CONFIGURED then "glk" isn't
>   ^                               ^
>   If                            returns
> 
> > initialized, which, if you got very unlucky, could cause a bug.
> 
> 
> In principle I'm OK with being cautious and initializing local
> variables just in case, but I'm curious:
> 
> acpi_acquire_global_lock() (and its friend, acpi_release_global_lock())
> are both wrapped inside the same macro -- ACPI_HW_DEPENDENT_RETURN_STATUS
> -- which either makes them both do something useful, or makes them both
> no-ops returning a hardcoded AE_NOT_CONFIGURED.
> 
> So what else do you think could be a way to get very unlucky ?

If "glk" happened to to equal acpi_gbl_global_lock_handle by chance
then we would release it without acquiring it first.  Actually I could
initialize it to zero and that would be better, no?

regards,
dan carpenter

  reply	other threads:[~2016-04-14 19:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14  9:33 [Qemu-devel] [patch] firmware: qemu_fw_cfg.c: potential unintialized variable Dan Carpenter
2016-04-14 18:40 ` Gabriel L. Somlo
2016-04-14 19:12   ` Dan Carpenter [this message]
2016-04-14 19:36     ` Gabriel L. Somlo
2016-04-14 20:05       ` Dan Carpenter
2016-04-14 19:51 ` Gabriel L. Somlo

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=20160414191253.GH4247@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    /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).