lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <f045945073f2d9698939ca7a0ec4bab3af1cb6e8.1544724747.git.aclaudi@redhat.com>
Date:   Thu, 13 Dec 2018 22:44:57 +0100
From:   Andrea Claudi <aclaudi@...hat.com>
To:     netdev@...r.kernel.org
Cc:     ast@...nel.org, daniel@...earbox.net, sbrivio@...hat.com
Subject: [PATCH bpf-next] bpf: remove useless variable

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>
---
 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;
 }
 
-- 
2.19.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ