From patchwork Thu Dec 13 21:44:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Claudi X-Patchwork-Id: 1013179 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43G6fd1QQhz9rxp for ; Fri, 14 Dec 2018 08:45:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726581AbeLMVpG (ORCPT ); Thu, 13 Dec 2018 16:45:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33698 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbeLMVpG (ORCPT ); Thu, 13 Dec 2018 16:45:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42D7A3099FD3; Thu, 13 Dec 2018 21:45:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC65061B78; Thu, 13 Dec 2018 21:45:04 +0000 (UTC) From: Andrea Claudi To: netdev@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, sbrivio@redhat.com Subject: [PATCH bpf-next] bpf: remove useless variable Date: Thu, 13 Dec 2018 22:44:57 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 13 Dec 2018 21:45:06 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Reviewed-by: Stefano Brivio --- net/core/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index aa274679965d..f31a0de14216 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2170,8 +2170,8 @@ static const struct bpf_func_proto bpf_msg_cork_bytes_proto = { BPF_CALL_4(bpf_msg_pull_data, struct sk_msg *, msg, u32, start, u32, end, u64, flags) { - u32 len = 0, offset = 0, copy = 0, poffset = 0, bytes = end - start; u32 first_sge, last_sge, i, shift, bytes_sg_total; + u32 len = 0, offset = 0, copy = 0, poffset = 0; struct scatterlist *sge; u8 *raw, *to, *from; struct page *page; @@ -2196,7 +2196,7 @@ BPF_CALL_4(bpf_msg_pull_data, struct sk_msg *, msg, u32, start, /* The start may point into the sg element so we need to also * account for the headroom. */ - bytes_sg_total = start - offset + bytes; + bytes_sg_total = end - offset; if (!msg->sg.copy[i] && bytes_sg_total <= len) goto out; @@ -2279,7 +2279,7 @@ BPF_CALL_4(bpf_msg_pull_data, struct sk_msg *, msg, u32, start, msg->sg.end - shift; out: msg->data = sg_virt(&msg->sg.data[first_sge]) + start - offset; - msg->data_end = msg->data + bytes; + msg->data_end = msg->data + end - start; return 0; }