qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: rutuja shah <rutu.shah.26@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, Fabien Chouteau <chouteau@adacore.com>,
	Alexander Graf <agraf@suse.de>, Blue Swirl <blauwirbel@gmail.com>,
	"qemu-ppc@nongnu.org list:PowerPC" <qemu-ppc@nongnu.org>,
	scottwood@freescale.com
Subject: Re: [Qemu-devel] [PATCH] Added NULL check for qemu_find_file()
Date: Tue, 15 Mar 2016 12:31:29 +0000	[thread overview]
Message-ID: <20160315123129.GI27203@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAFE_T+Rg-L9EZzDboHXvhJLwO28N6YuTz2S-vMN6siPz_fprfg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

On Mon, Mar 14, 2016 at 06:29:06PM +0530, rutuja shah wrote:
> > What is the benefit of adding the NULL checks?  The only difference I
> > see is that the error message from load_elf() is silenced.
> Yes, in case of load_elf, error message is silenced. The immediate
> call to load_uimage()
> is conditional to error from load_elf(). load_uimage() in turn calls
> load_uboot_image() which
> then calls open() with NULL filename and returns with -1. In my
> opinion, this can be avoided.
> >
> > Avoiding unnecessary function calls isn't worthwhile if all callers now
> > duplicate the if (filename) ... else size = -1 code.
> As far as I have seen the code, all callers have this check in place
> already, except the patched files.

Does this mean the main purpose of the patch is to make these
load_elf()/load_uimage() callers consistent with other callers?

The commit description should say "why" rather than "what" the patch is
doing.

In it's current state I'm not sure what the benefit of this change is.
I also wonder whether the load_elf()/load_uimage() function prototype
should be adjusted to avoid the boilerplate if statement in all callers.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-03-15 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12 20:36 [Qemu-devel] [PATCH] Added NULL check for qemu_find_file() rutu.shah.26
2016-03-14 11:44 ` Stefan Hajnoczi
2016-03-14 12:59   ` rutuja shah
2016-03-15 12:31     ` Stefan Hajnoczi [this message]
2016-03-15 12:56       ` rutuja shah
2016-03-16 11:35         ` Stefan Hajnoczi
2016-03-14 15:34 ` Eric Blake

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=20160315123129.GI27203@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=agraf@suse.de \
    --cc=blauwirbel@gmail.com \
    --cc=chouteau@adacore.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rutu.shah.26@gmail.com \
    --cc=scottwood@freescale.com \
    /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).