All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: kernel/bpf/btf.c:3827:24: warning: Variable 'tag' is not assigned a value. [unassignedVariable]
Date: Thu, 24 Mar 2022 06:37:24 +0800	[thread overview]
Message-ID: <202203240646.5CTPzoky-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4523 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Yonghong Song <yhs@fb.com>
CC: Alexei Starovoitov <ast@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6b1f86f8e9c7f9de7ca1cb987b2cf25e99b1ae3a
commit: b5ea834dde6b6e7f75e51d5f66dac8cd7c97b5ef bpf: Support for new btf kind BTF_KIND_TAG
date:   6 months ago
:::::: branch date: 21 hours ago
:::::: commit date: 6 months ago
compiler: microblaze-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

                ^
   kernel/bpf/btf.c:4849:38: note: Null pointer addition
    args = (const struct btf_param *)(t + 1);
                                        ^
   kernel/bpf/btf.c:4534:5: warning: union member 'Anonymous2::__t' is never used. [unusedStructMember]
    } *__t;
       ^
>> kernel/bpf/btf.c:3827:24: warning: Variable 'tag' is not assigned a value. [unassignedVariable]
    const struct btf_tag *tag;
                          ^

vim +/tag +3827 kernel/bpf/btf.c

b1828f0b04828aa Ilya Leoshkevich 2021-02-26  3822  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3823  static s32 btf_tag_check_meta(struct btf_verifier_env *env,
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3824  			      const struct btf_type *t,
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3825  			      u32 meta_left)
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3826  {
b5ea834dde6b6e7 Yonghong Song    2021-09-14 @3827  	const struct btf_tag *tag;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3828  	u32 meta_needed = sizeof(*tag);
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3829  	s32 component_idx;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3830  	const char *value;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3831  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3832  	if (meta_left < meta_needed) {
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3833  		btf_verifier_log_basic(env, t,
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3834  				       "meta_left:%u meta_needed:%u",
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3835  				       meta_left, meta_needed);
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3836  		return -EINVAL;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3837  	}
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3838  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3839  	value = btf_name_by_offset(env->btf, t->name_off);
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3840  	if (!value || !value[0]) {
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3841  		btf_verifier_log_type(env, t, "Invalid value");
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3842  		return -EINVAL;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3843  	}
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3844  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3845  	if (btf_type_vlen(t)) {
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3846  		btf_verifier_log_type(env, t, "vlen != 0");
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3847  		return -EINVAL;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3848  	}
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3849  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3850  	if (btf_type_kflag(t)) {
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3851  		btf_verifier_log_type(env, t, "Invalid btf_info kind_flag");
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3852  		return -EINVAL;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3853  	}
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3854  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3855  	component_idx = btf_type_tag(t)->component_idx;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3856  	if (component_idx < -1) {
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3857  		btf_verifier_log_type(env, t, "Invalid component_idx");
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3858  		return -EINVAL;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3859  	}
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3860  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3861  	btf_verifier_log_type(env, t, NULL);
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3862  
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3863  	return meta_needed;
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3864  }
b5ea834dde6b6e7 Yonghong Song    2021-09-14  3865  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

             reply	other threads:[~2022-03-23 22:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 22:37 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-30  5:32 kernel/bpf/btf.c:3827:24: warning: Variable 'tag' is not assigned a value. [unassignedVariable] kernel test robot
2022-01-20  3:27 kernel test robot
2021-12-07 13:03 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202203240646.5CTPzoky-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.