Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ABEEC433EF for ; Wed, 8 Dec 2021 03:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243821AbhLHDIb (ORCPT ); Tue, 7 Dec 2021 22:08:31 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:28286 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243835AbhLHDI0 (ORCPT ); Tue, 7 Dec 2021 22:08:26 -0500 Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4J8288504BzbjHm; Wed, 8 Dec 2021 11:04:40 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 8 Dec 2021 11:04:53 +0800 From: Xiu Jianfeng To: , , , , , , , , , , , , , , , CC: , , Subject: [PATCH -next 2/2] bpf: use memset_range helper in __mark_reg_known Date: Wed, 8 Dec 2021 11:04:51 +0800 Message-ID: <20211208030451.219751-3-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211208030451.219751-1-xiujianfeng@huawei.com> References: <20211208030451.219751-1-xiujianfeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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