From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio Subject: Re: [PATCH bpf-next] bpf: remove useless variable Date: Fri, 14 Dec 2018 18:14:52 +0100 Message-ID: <20181214181452.356c4834@redhat.com> References: <20181214170300.ah2lto3733psf2jy@kafai-mbp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Andrea Claudi , "netdev@vger.kernel.org" , "ast@kernel.org" , "daniel@iogearbox.net" , John Fastabend To: Martin Lau Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59480 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729508AbeLNRPA (ORCPT ); Fri, 14 Dec 2018 12:15:00 -0500 In-Reply-To: <20181214170300.ah2lto3733psf2jy@kafai-mbp> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 14 Dec 2018 17:03:02 +0000 Martin Lau 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 > > Signed-off-by: Andrea Claudi > 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