lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202207131941.ZTw3SDaO-lkp@intel.com>
Date:   Wed, 13 Jul 2022 19:24:21 +0800
From:   kernel test robot <lkp@...el.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        Daniel Borkmann <daniel@...earbox.net>,
        linux-kernel@...r.kernel.org
Subject: [cilium:pr/meta5 4/4] kernel/bpf/net.c:52:28: warning: variable
 'peer' is uninitialized when used here

tree:   https://github.com/cilium/linux.git pr/meta5
head:   3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
commit: 3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5 [4/4] bpf: Add fd-based API to attach tc BPF programs
config: hexagon-randconfig-r003-20220712 (https://download.01.org/0day-ci/archive/20220713/202207131941.ZTw3SDaO-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e60b4fb2b777118c0ff664a6347851df14fcf75b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/cilium/linux/commit/3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
        git remote add cilium https://github.com/cilium/linux.git
        git fetch --no-tags cilium pr/meta5
        git checkout 3dd186e5096ad47e2a3e6a5d00dd9d67513a95e5
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/bpf/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> kernel/bpf/net.c:52:28: warning: variable 'peer' is uninitialized when used here [-Wuninitialized]
                                   dev_sch_entry_prio_set(peer, prio, nprog);
                                                          ^~~~
   kernel/bpf/net.c:33:32: note: initialize the variable 'peer' to silence this warning
           struct sch_entry *entry, *peer;
                                         ^
                                          = NULL
   1 warning generated.


vim +/peer +52 kernel/bpf/net.c

    28	
    29	static int __sch_prog_attach(struct net_device *dev, bool ingress, u32 limit,
    30				     struct bpf_prog *nprog, u32 prio, u32 flags)
    31	{
    32		struct bpf_prog_array_item *item, *tmp;
    33		struct sch_entry *entry, *peer;
    34		struct bpf_prog *oprog;
    35		bool created;
    36		int i, j;
    37	
    38		entry = dev_sch_entry_fetch(dev, ingress, &created);
    39		if (!entry)
    40			return -ENOMEM;
    41		for (i = 0; i < limit; i++) {
    42			item = &entry->items[i];
    43			oprog = item->prog;
    44			if (!oprog)
    45				break;
    46			if (item->bpf_priority == prio) {
    47				if (flags & BPF_F_REPLACE) {
    48					/* Pairs with READ_ONCE() in sch_run_progs(). */
    49					WRITE_ONCE(item->prog, nprog);
    50					if (sch_prog_refcounted(oprog))
    51						bpf_prog_put(oprog);
  > 52					dev_sch_entry_prio_set(peer, prio, nprog);
    53					return prio;
    54				}
    55				return -EBUSY;
    56			}
    57		}
    58		if (dev_sch_entry_total(entry) >= limit)
    59			return -ENOSPC;
    60		prio = dev_sch_entry_prio_new(entry, prio, nprog);
    61		if (prio < 0) {
    62			if (created)
    63				dev_sch_entry_free(entry);
    64			return -ENOMEM;
    65		}
    66		peer = dev_sch_entry_peer(entry);
    67		dev_sch_entry_clear(peer);
    68		for (i = 0, j = 0; i < limit; i++, j++) {
    69			item = &entry->items[i];
    70			tmp = &peer->items[j];
    71			oprog = item->prog;
    72			if (!oprog) {
    73				if (i == j) {
    74					tmp->prog = nprog;
    75					tmp->bpf_priority = prio;
    76				}
    77				break;
    78			} else if (item->bpf_priority < prio) {
    79				tmp->prog = oprog;
    80				tmp->bpf_priority = item->bpf_priority;
    81			} else if (item->bpf_priority > prio) {
    82				if (i == j) {
    83					tmp->prog = nprog;
    84					tmp->bpf_priority = prio;
    85					tmp = &peer->items[++j];
    86				}
    87				tmp->prog = oprog;
    88				tmp->bpf_priority = item->bpf_priority;
    89			}
    90		}
    91		dev_sch_entry_update(dev, peer, ingress);
    92		if (ingress)
    93			net_inc_ingress_queue();
    94		else
    95			net_inc_egress_queue();
    96		return prio;
    97	}
    98	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ