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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211208030451.219751-3-xiujianfeng@huawei.com>
Date:   Wed, 8 Dec 2021 11:04:51 +0800
From:   Xiu Jianfeng <xiujianfeng@...wei.com>
To:     <akpm@...ux-foundation.org>, <keescook@...omium.org>,
        <laniel_francis@...vacyrequired.com>,
        <andriy.shevchenko@...ux.intel.com>, <adobriyan@...il.com>,
        <linux@...ck-us.net>, <andreyknvl@...il.com>, <dja@...ens.net>,
        <ast@...nel.org>, <daniel@...earbox.net>, <andrii@...nel.org>,
        <kafai@...com>, <songliubraving@...com>, <yhs@...com>,
        <john.fastabend@...il.com>, <kpsingh@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
        <bpf@...r.kernel.org>
Subject: [PATCH -next 2/2] bpf: use memset_range helper in __mark_reg_known

Replace the open-coded memset with memset_range helper to simplify
the code, there is no functional change in this patch.

Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
---
 kernel/bpf/verifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 7a20e12f2e45..317f259c0103 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1099,9 +1099,8 @@ static void ___mark_reg_known(struct bpf_reg_state *reg, u64 imm)
  */
 static void __mark_reg_known(struct bpf_reg_state *reg, u64 imm)
 {
-	/* Clear id, off, and union(map_ptr, range) */
-	memset(((u8 *)reg) + sizeof(reg->type), 0,
-	       offsetof(struct bpf_reg_state, var_off) - sizeof(reg->type));
+	/* Clear off, union(map_ptr, range), id, and ref_obj_id */
+	memset_range(reg, 0, off, ref_obj_id);
 	___mark_reg_known(reg, imm);
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ