Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp332314iob; Fri, 13 May 2022 02:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7wad5xmCRRRNB/6tCIp3UyHRvhQT14ZE7oOdhenowmtX+zRQgi8Ts1+DdDySipce2jfG/ X-Received: by 2002:a17:903:185:b0:15e:8bfa:ed63 with SMTP id z5-20020a170903018500b0015e8bfaed63mr4110938plg.153.1652434990570; Fri, 13 May 2022 02:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652434990; cv=none; d=google.com; s=arc-20160816; b=qkWO1lc6VNWZP9/4W9URdXICFQ8hmpDaK/51jlQuwt8nnFntIvXQRJpHu9hq5mbeSL DNQjkPpr4Mu/CYUbTOXH4sz7tECfNqeCyfwaAY3AdFL/ZXrm+rXKLHS9P38gywRSg4sW AvBCxsZNs2RI0vd9vTvmme1gWBGAxa36L6SIvnkurcd8OYpra7+ZalTbu2qvmD2bKeJ8 r7YevBhLfDrsSrZFbBbnfaky9ZtZX6NIDIxkO6CcA+Nham921WwutrPmi55FEE8iyyK8 KB0n+f0L0xr7iNSqBClSltsn3VgnLF+bVB6vggqq79Pq11fYzRmfOXG/SBPJYG4oI4nm a0sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=RSfhkSyW2FGX+NNCwzcnqHrGNF+vVJOV6buEnF3F/do=; b=pGXzye6g63R+09NII4F/sBu2wEyXtjExAHKt+qVknUOULftp335pT/CmSDGsOePu/y YTXt2EzGVQEl73JODcbtiJkV5abDy/PqQz3gPyJA3ZAoI4PY8i1F/NzGo4lhjnuX4vXf t0A9qUvucfsC4E4/t+tsXp8Xj5JXK6Mdn+oHw6xoiFWcSw7LLIRVn0jr4OrllzDyKLRR +1uApxRKcSs0Re2EYJDwbBOj4CqtbkMenKOGFR8wy5LOKCDuPVUAerE17d7TmiFmXV3L M+uRzBMtTciaLz927RBjwJoXjxq66N4RJ72QuQSmUIt4x4SZXCE2FgwWz4vFWK0L32Qx HEjQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a056a00098600b0050df0383302si2695135pfg.255.2022.05.13.02.42.57; Fri, 13 May 2022 02:43:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355257AbiELO3R (ORCPT + 99 others); Thu, 12 May 2022 10:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344674AbiELO3O (ORCPT ); Thu, 12 May 2022 10:29:14 -0400 Received: from mail.nfschina.com (unknown [IPv6:2400:dd01:100f:2:72e2:84ff:fe10:5f45]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AB5FC62127; Thu, 12 May 2022 07:29:12 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 5F0391E80D22; Thu, 12 May 2022 22:23:35 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xYV0EK951nP4; Thu, 12 May 2022 22:23:32 +0800 (CST) Received: from localhost.localdomain (unknown [180.167.10.98]) (Authenticated sender: liqiong@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id C13A21E80D04; Thu, 12 May 2022 22:23:31 +0800 (CST) From: liqiong To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, hukun@nfschina.com, qixu@nfschina.com, yuzhe@nfschina.com, renyu@nfschina.com, liqiong Subject: [PATCH 1/2] kernel/bpf: change "char *" string form to "char []" Date: Thu, 12 May 2022 22:28:14 +0800 Message-Id: <20220512142814.26705-1-liqiong@nfschina.com> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The string form of "char []" declares a single variable. It is better than "char *" which creates two variables. Signed-off-by: liqiong --- kernel/bpf/btf.c | 4 ++-- kernel/bpf/verifier.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0918a39279f6..218a8ac73644 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -894,10 +894,10 @@ static const struct btf_type *btf_type_skip_qualifiers(const struct btf *btf, static const char *btf_show_name(struct btf_show *show) { /* BTF_MAX_ITER array suffixes "[]" */ - const char *array_suffixes = "[][][][][][][][][][]"; + static const char array_suffixes[] = "[][][][][][][][][][]"; const char *array_suffix = &array_suffixes[strlen(array_suffixes)]; /* BTF_MAX_ITER pointer suffixes "*" */ - const char *ptr_suffixes = "**********"; + static const char ptr_suffixes[] = "**********"; const char *ptr_suffix = &ptr_suffixes[strlen(ptr_suffixes)]; const char *name = NULL, *prefix = "", *parens = ""; const struct btf_member *m = show->state.member; diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d175b70067b3..78a090fcbc72 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -7346,7 +7346,7 @@ static int sanitize_err(struct bpf_verifier_env *env, const struct bpf_reg_state *off_reg, const struct bpf_reg_state *dst_reg) { - static const char *err = "pointer arithmetic with it prohibited for !root"; + static const char err[] = "pointer arithmetic with it prohibited for !root"; const char *op = BPF_OP(insn->code) == BPF_ADD ? "add" : "sub"; u32 dst = insn->dst_reg, src = insn->src_reg; -- 2.25.1