Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp128242rwb; Sat, 17 Sep 2022 02:10:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rrPTe9JerwCMSIPAPXctA51dy8Uxm9qnkPwC3HxoJs7ljcmIF48aNZLyTXT9tHXh59VG/ X-Received: by 2002:a05:6a00:1488:b0:542:78a:3f8a with SMTP id v8-20020a056a00148800b00542078a3f8amr9359288pfu.85.1663405855801; Sat, 17 Sep 2022 02:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663405855; cv=none; d=google.com; s=arc-20160816; b=ngd1d07FbJKkuEeeXE4FME+aLlsD67QbzlHukWEdOdvy1kLIuZk3YCmquOCUoyVAkn 5KB5F9Iu6tAAXz5wqtsLmP7EddbiK+6TE1Vdop+UlinIqDLI3eq+hzUa/FGlvbGp+AKw LWoQelUYzOLMuYKEM0ealI/EEz7LzSihs919IzabHqE0ygvGzJIrwM23xgFLXKKWxtwu kbJByP2QdAJQT5HAf0pHSIEkJ0N+7843B6wgd4W3v0eZGtIuFZLjW6ttEIMWMU7hpAma KvRGf0kPa7BXs211Sw7r1achqfZfadug1ycusrJ91zKerKPdi24IKv2qvt868+T13EgH XxYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=qu8I8YuJXw2M3hcQgEmGhnOxzHzTnOpfQLL1aurP3gI=; b=S03j5hBfSn/Ks/f+w0wpcVTC9L6aBxQ6SM/eK0fdLc0bQy+Hf40O9CxX/zK7Ar+GBR J1lW724CypFJ5ys4yv4sxz8DY211b7IDHwUmfAVeGPA98a8Q5IlcS41urk66Z3HRxYWM cjNdLOHtDTScTc4K6hWUp4dS1pk86JRICv01Yfujx2JJ4mbkD+gJDbOi8WaCeMJuLgZI PmNybofBHneaJcpc83oKLo3iuwa8G1/gXKgZFu+tr8LQScPmraWOrOeTzHj4zngWsZDE JYzTi6xhCAqyFPtEe5jH+mCyGNKGW1nLDttjkyNknJEuyzwd2tLgQglOKVfpSZ6/1gUv ljtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=GKYo1wnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a656649000000b0043863322f07si25742347pgv.805.2022.09.17.02.10.44; Sat, 17 Sep 2022 02:10:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=GKYo1wnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiIQInc (ORCPT + 99 others); Sat, 17 Sep 2022 04:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiIQIna (ORCPT ); Sat, 17 Sep 2022 04:43:30 -0400 Received: from mail-m974.mail.163.com (mail-m974.mail.163.com [123.126.97.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C1F5D33E01; Sat, 17 Sep 2022 01:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=qu8I8 YuJXw2M3hcQgEmGhnOxzHzTnOpfQLL1aurP3gI=; b=GKYo1wnVQ9W7++m/gxDhy h5+k3MWm4MhGqdN/BMT+hvTTZsDZmxhQJcOQ8/kBu6Gkyoqo+cJ3td6wu6Za3UCc ZTvCJ6ALUpgNOjaNT9grYpjZB9JlwRBF+9tQZgYHYMneTr636qO2J92LxjQfs7zw qLInSOkfE/Kq/Ffj3b7KQE= Received: from DESKTOP-CE2KKHI.localdomain (unknown [124.160.210.227]) by smtp4 (Coremail) with SMTP id HNxpCgD3TtOKiCVj9QEZdw--.2977S2; Sat, 17 Sep 2022 16:42:52 +0800 (CST) From: williamsukatube@163.com To: martin.lau@linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, William Dean Subject: [PATCH -next] bpf: simplify code in btf_parse_hdr Date: Sat, 17 Sep 2022 16:42:48 +0800 Message-Id: <20220917084248.3649-1-williamsukatube@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: HNxpCgD3TtOKiCVj9QEZdw--.2977S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7GFWkur45Jw13KF4fAF4xWFg_yoWfKFXE9r 18uanxur4DJFWFyw1UAa4IvFyjqF4vgF9rZwsFvrWkCw15Gw45Crn8WFsakFWvqws7tF9r GFs8Cas0yF4fujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_rb13UUUUU== X-Originating-IP: [124.160.210.227] X-CM-SenderInfo: xzlozx5dpv3yxdwxuvi6rwjhhfrp/xtbB0Ax-g2Esr7zWwAAAso X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: William Dean It could directly return 'btf_check_sec_info' to simplify code. Signed-off-by: William Dean --- kernel/bpf/btf.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 7e64447659f3..80eda86ddfce 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4854,7 +4854,6 @@ static int btf_parse_hdr(struct btf_verifier_env *env) u32 hdr_len, hdr_copy, btf_data_size; const struct btf_header *hdr; struct btf *btf; - int err; btf = env->btf; btf_data_size = btf->data_size; @@ -4911,11 +4910,7 @@ static int btf_parse_hdr(struct btf_verifier_env *env) return -EINVAL; } - err = btf_check_sec_info(env, btf_data_size); - if (err) - return err; - - return 0; + return btf_check_sec_info(env, btf_data_size); } static int btf_check_type_tags(struct btf_verifier_env *env, -- 2.25.1