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: Wed, 16 Mar 2016 11:35:45 +0000 [thread overview]
Message-ID: <20160316113545.GD31512@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAFE_T+RxZKuJ9HMD5YdGXcBWgdWCiXARYO86399qksCh4WCjCQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]
On Tue, Mar 15, 2016 at 06:26:05PM +0530, rutuja shah wrote:
> On Tue, Mar 15, 2016 at 6:01 PM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> > 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?
> This is a task listed on http://qemu-project.org/BiteSizedTasks
> (presently, I am unaware of the intention it is put up here). I
> propose this change so that callers are consistent. Also it adds to
> the performance, if such a case is encountered for reasons mentioned
> earlier.
The task description on the wiki is terse. I'm not sure the intention
was to make the change you have posted. I suspect the issue is related
to unexpected behavior due to callers dereferencing a NULL filename
pointer or assuming size > 0.
Maybe one of the CCed maintainers remembers or has an opinion. If there
is no additional feedback from anyone then I'd hold back on this patch
because it perturbs the code without a strong reason to do so.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-03-16 11:36 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
2016-03-15 12:56 ` rutuja shah
2016-03-16 11:35 ` Stefan Hajnoczi [this message]
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=20160316113545.GD31512@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).