BPF Archive on lore.kernel.org
 help / color / Atom feed
* [bug report] bpf: Introduce BPF trampoline
@ 2019-11-26 12:19 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-11-26 12:19 UTC (permalink / raw)
  To: ast; +Cc: bpf

Hello Alexei Starovoitov,

The patch fec56f5890d9: "bpf: Introduce BPF trampoline" from Nov 14,
2019, leads to the following static checker warning:

	kernel/bpf/btf.c:4023 btf_distill_func_proto()
	error: potentially dereferencing uninitialized 't'.

kernel/bpf/btf.c
  4012          nargs = btf_type_vlen(func);
  4013          if (nargs >= MAX_BPF_FUNC_ARGS) {
  4014                  bpf_log(log,
  4015                          "The function %s has %d arguments. Too many.\n",
  4016                          tname, nargs);
  4017                  return -EINVAL;
  4018          }
  4019          ret = __get_type_size(btf, func->type, &t);
                                                       ^^
t isn't initialized for the first -EINVAL return

  4020          if (ret < 0) {
  4021                  bpf_log(log,
  4022                          "The function %s return type %s is unsupported.\n",
  4023                          tname, btf_kind_str[BTF_INFO_KIND(t->info)]);
                                                                  ^^^^^^^
  4024                  return -EINVAL;
  4025          }
  4026          m->ret_size = ret;

See also:
kernel/bpf/btf.c:4033 btf_distill_func_proto() error: potentially dereferencing uninitialized 't'.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 12:19 [bug report] bpf: Introduce BPF trampoline Dan Carpenter

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git