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]
Date:   Fri, 27 Apr 2018 17:04:09 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Alexei Starovoitov <ast@...nel.org>,
        Martin KaFai Lau <kafai@...com>
Cc:     Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] bpf: btf: silence uninitialize variable warnings

Smatch complains that size can be uninitialized if btf_type_id_size()
returns NULL.  It seems reasonable enough to check for that.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
This goes to the BPF tree (linux-next).

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 22e1046a1a86..e631b6fd60d3 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -1229,7 +1229,8 @@ static int btf_array_check_member(struct btf_verifier_env *env,
 	}
 
 	array_type_id = member->type;
-	btf_type_id_size(btf, &array_type_id, &array_size);
+	if (!btf_type_id_size(btf, &array_type_id, &array_size))
+		return -EINVAL;
 	struct_size = struct_type->size;
 	bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
 	if (struct_size - bytes_offset < array_size) {
@@ -1351,6 +1352,8 @@ static void btf_array_seq_show(const struct btf *btf, const struct btf_type *t,
 
 	elem_type_id = array->type;
 	elem_type = btf_type_id_size(btf, &elem_type_id, &elem_size);
+	if (!elem_type)
+		return;
 	elem_ops = btf_type_ops(elem_type);
 	seq_puts(m, "[");
 	for (i = 0; i < array->nelems; i++) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ