netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Martin Lau <kafai@fb.com>
Cc: Andrea Claudi <aclaudi@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>
Subject: Re: [PATCH bpf-next] bpf: remove useless variable
Date: Fri, 14 Dec 2018 18:14:52 +0100	[thread overview]
Message-ID: <20181214181452.356c4834@redhat.com> (raw)
In-Reply-To: <20181214170300.ah2lto3733psf2jy@kafai-mbp>

On Fri, 14 Dec 2018 17:03:02 +0000
Martin Lau <kafai@fb.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@redhat.com>
> > Signed-off-by: Andrea Claudi <aclaudi@redhat.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

  reply	other threads:[~2018-12-14 17:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 21:44 [PATCH bpf-next] bpf: remove useless variable Andrea Claudi
2018-12-14 11:24 ` Stefano Brivio
2018-12-14 17:03 ` Martin Lau
2018-12-14 17:14   ` Stefano Brivio [this message]
2018-12-15  1:13   ` Daniel Borkmann

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=20181214181452.356c4834@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=aclaudi@redhat.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.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).