[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181214181452.356c4834@redhat.com>
Date: Fri, 14 Dec 2018 18:14:52 +0100
From: Stefano Brivio <sbrivio@...hat.com>
To: Martin Lau <kafai@...com>
Cc: Andrea Claudi <aclaudi@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>
Subject: Re: [PATCH bpf-next] bpf: remove useless variable
On Fri, 14 Dec 2018 17:03:02 +0000
Martin Lau <kafai@...com> wrote:
> On Thu, Dec 13, 2018 at 10:44:57PM +0100, Andrea Claudi wrote:
> > bytes is initialized to end - start at the beginning of this function,
> > and is never changed. Remove it making the code a bit more readable.
> >
> > Suggested-by: Stefano Brivio <sbrivio@...hat.com>
> > Signed-off-by: Andrea Claudi <aclaudi@...hat.com>
> The change looks correct.
> I found the original code more intuitive to read though.
> Daniel/John, thoughts?
In detail: the idea behind my suggestion was that:
bytes_sg_total = start - offset + bytes;
sounds like: start from 'start', move back by 'offset' (where am I
now?), add 'bytes' (what is 'bytes'? Oh, it's end - start...). Whereas:
bytes_sg_total = end - offset;
looked easier to follow: total bytes are the distance between 'end' and
'offset'.
--
Stefano
Powered by blists - more mailing lists