[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 07 Jul 2016 06:21:18 -0600
From: "Jan Beulich" <JBeulich@...e.com>
To: "David Vrabel" <david.vrabel@...rix.com>,
"Paul Durrant" <Paul.Durrant@...rix.com>,
"Wei Liu" <wei.liu2@...rix.com>
Cc: "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [Xen-devel] [PATCH] xen-netback: correct return value
checks on xenbus_scanf()
>>> On 07.07.16 at 12:55, <Paul.Durrant@...rix.com> wrote:
>> -----Original Message-----
>> From: netdev-owner@...r.kernel.org [mailto:netdev-
>> owner@...r.kernel.org] On Behalf Of David Vrabel
>> Sent: 07 July 2016 11:45
>> To: Wei Liu; David Vrabel
>> Cc: xen-devel@...ts.xenproject.org; Jan Beulich; netdev@...r.kernel.org
>> Subject: Re: [Xen-devel] [PATCH] xen-netback: correct return value checks
>> on xenbus_scanf()
>>
>> On 07/07/16 11:35, Wei Liu wrote:
>> > On Thu, Jul 07, 2016 at 10:58:16AM +0100, David Vrabel wrote:
>> >> On 07/07/16 08:57, Jan Beulich wrote:
>> >>> Only a positive return value indicates success.
>> >>
>> >> This is not correct.
>> >>
>> >
>> > Do you mean the commit message is not correct or the code is not
>> > correct? If it is the formal, do you have any suggestion to fix it?
>>
>> This code is correct as-is, thus the commit message is wrong or misleading.
>
> Is that true? Jan is correct in saying that only >0 is an indicator of
> success according to the usual semantics of sccanf().
As was correctly pointed out, xenbus_scanf(), other than scanf(),
can't return zero right now (which I think has corner cases where
this might be a problem). So if I would get the feeling that a
correction (benign or not at this point in time) would be accepted,
what about "Only a positive return value is guaranteed to indicates
success" as commit description?
> Personally I think the
> code would be clearer if the checks for failure were < 1 rather than <= 0.
I'd be fine with that, albeit if comparing with any non-zero number
then I think it would better be == or != instead of < or <=.
Jan
Powered by blists - more mailing lists