xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Wei Liu <wei.liu2@citrix.com>,
	xen-devel@lists.xenproject.org,
	Ian Jackson <ian.jackson@citrix.com>
Subject: Re: [PATCH for-4.10] fuzz/x86_emulate: Fix afl-harness batch mode file pointer leak
Date: Fri, 13 Oct 2017 11:36:44 +0100	[thread overview]
Message-ID: <9deff48f-cae7-7b44-d4cd-16463c6a56f7@citrix.com> (raw)
In-Reply-To: <59E0B20B0200007800186182@prv-mh.provo.novell.com>

On 10/13/2017 11:31 AM, Jan Beulich wrote:
>>>> On 13.10.17 at 12:23, <george.dunlap@citrix.com> wrote:
>> On 10/13/2017 10:20 AM, Jan Beulich wrote:
>>>>>> On 13.10.17 at 11:10, <george.dunlap@citrix.com> wrote:
>>>> On 10/13/2017 10:06 AM, Jan Beulich wrote:
>>>>>>>> On 13.10.17 at 11:00, <george.dunlap@citrix.com> wrote:
>>>>>> --- a/tools/fuzz/x86_instruction_emulator/afl-harness.c
>>>>>> +++ b/tools/fuzz/x86_instruction_emulator/afl-harness.c
>>>>>> @@ -99,13 +99,17 @@ int main(int argc, char **argv)
>>>>>>              exit(-1);
>>>>>>          }
>>>>>>  
>>>>>> -        if ( !feof(fp) )
>>>>>> +        /* Only run the test if the input file was smaller than INPUT_SIZE */
>>>>>> +        if ( feof(fp) )
>>>>>> +        {
>>>>>> +            LLVMFuzzerTestOneInput(input, size);
>>>>>> +        }
>>>>>
>>>>> ... ideally with the unnecessary braces dropped here
>>>>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>>>>
>>>> Do you really want this to look like this?
>>>>
>>>> if ( ... )
>>>>    foo();
>>>> else
>>>> {
>>>>    ...
>>>> }
>>>
>>> Yes. It's Linux and qemu who dislike non-matched if/else bodies,
>>> but our ./CODING_STYLE only says
>>>
>>> "Braces should be omitted for blocks with a single statement. e.g.,
>>>  
>>>  if ( condition )
>>>      single_statement();"
>>>
>>> and personally I'm happy that it doesn't say anything more.
>>
>> Hmm, I personally think it's ugly enough that I'd rather restructure the
>> code to avoid it looking like that. :-)
>>
>> I'll see what I can do.
> 
> Well, assuming you would think that way I've intentionally said
> "ideally", i.e. if you really don't want to change it, I can live with
> the braces.

OK, thanks. :-)

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-10-13 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  9:00 [PATCH for-4.10] fuzz/x86_emulate: Fix afl-harness batch mode file pointer leak George Dunlap
2017-10-13  9:06 ` Jan Beulich
2017-10-13  9:10   ` George Dunlap
2017-10-13  9:20     ` Jan Beulich
2017-10-13 10:23       ` George Dunlap
2017-10-13 10:31         ` Jan Beulich
2017-10-13 10:36           ` George Dunlap [this message]
2017-10-13  9:12   ` George Dunlap
2017-10-17 13:39 ` Julien Grall

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=9deff48f-cae7-7b44-d4cd-16463c6a56f7@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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).