public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>
Subject: kernel/trace/bpf_trace.c:1181:23: warning: Uninitialized variable: t
Date: Sat, 31 Oct 2020 13:49:17 +0800	[thread overview]
Message-ID: <202010311312.RRUikhQ7-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5fc6b075e165f641fbc366b58b578055762d5f8c
commit: c4d0bfb45068d853a478b9067a95969b1886a30f bpf: Add bpf_snprintf_btf helper
date:   5 weeks ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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


"cppcheck warnings: (new ones prefixed by >>)"
>> kernel/trace/bpf_trace.c:1181:23: warning: Uninitialized variable: t [uninitvar]
    if (*btf_id <= 0 || !t)
                         ^

vim +1181 kernel/trace/bpf_trace.c

  1153	
  1154	#define BTF_F_ALL	(BTF_F_COMPACT  | BTF_F_NONAME | \
  1155				 BTF_F_PTR_RAW | BTF_F_ZERO)
  1156	
  1157	static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size,
  1158					  u64 flags, const struct btf **btf,
  1159					  s32 *btf_id)
  1160	{
  1161		const struct btf_type *t;
  1162	
  1163		if (unlikely(flags & ~(BTF_F_ALL)))
  1164			return -EINVAL;
  1165	
  1166		if (btf_ptr_size != sizeof(struct btf_ptr))
  1167			return -EINVAL;
  1168	
  1169		*btf = bpf_get_btf_vmlinux();
  1170	
  1171		if (IS_ERR_OR_NULL(*btf))
  1172			return PTR_ERR(*btf);
  1173	
  1174		if (ptr->type_id > 0)
  1175			*btf_id = ptr->type_id;
  1176		else
  1177			return -EINVAL;
  1178	
  1179		if (*btf_id > 0)
  1180			t = btf_type_by_id(*btf, *btf_id);
> 1181		if (*btf_id <= 0 || !t)
  1182			return -ENOENT;
  1183	
  1184		return 0;
  1185	}
  1186	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

                 reply	other threads:[~2020-10-31  5:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202010311312.RRUikhQ7-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alan.maguire@oracle.com \
    --cc=ast@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox