All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] sched: address a potential NULL pointer dereference in the GRED scheduler.
Date: Fri, 7 Mar 2025 09:32:53 +0800	[thread overview]
Message-ID: <202503070956.I8Z06FRE-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250304141858.3392957-2-juny24602@gmail.com>
References: <20250304141858.3392957-2-juny24602@gmail.com>
TO: kwqcheii <juny24602@gmail.com>
TO: netdev@vger.kernel.org
CC: kwqcheii <juny24602@gmail.com>

Hi kwqcheii,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.14-rc5 next-20250306]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/kwqcheii/sched-address-a-potential-NULL-pointer-dereference-in-the-GRED-scheduler/20250304-224144
base:   linus/master
patch link:    https://lore.kernel.org/r/20250304141858.3392957-2-juny24602%40gmail.com
patch subject: [PATCH] sched: address a potential NULL pointer dereference in the GRED scheduler.
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-r072-20250306 (https://download.01.org/0day-ci/archive/20250307/202503070956.I8Z06FRE-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503070956.I8Z06FRE-lkp@intel.com/

New smatch warnings:
net/sched/sch_gred.c:330 gred_offload() error: we previously assumed 'opt' could be null (see line 320)

Old smatch warnings:
net/sched/sch_gred.c:474 gred_change_table_def() warn: potential spectre issue 'table->tab' [w]

vim +/opt +330 net/sched/sch_gred.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  310  
890d8d23ec3c9e Jakub Kicinski 2018-11-19  311  static void gred_offload(struct Qdisc *sch, enum tc_gred_command command)
890d8d23ec3c9e Jakub Kicinski 2018-11-19  312  {
890d8d23ec3c9e Jakub Kicinski 2018-11-19  313  	struct gred_sched *table = qdisc_priv(sch);
890d8d23ec3c9e Jakub Kicinski 2018-11-19  314  	struct net_device *dev = qdisc_dev(sch);
f25c0515c52137 Arnd Bergmann  2021-10-26  315  	struct tc_gred_qopt_offload *opt = table->opt;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  316  
890d8d23ec3c9e Jakub Kicinski 2018-11-19  317  	if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc)
890d8d23ec3c9e Jakub Kicinski 2018-11-19  318  		return;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  319  
8eb926feee9101 kwqcheii       2025-03-04 @320  	if (opt) {
f25c0515c52137 Arnd Bergmann  2021-10-26  321  		memset(opt, 0, sizeof(*opt));
f25c0515c52137 Arnd Bergmann  2021-10-26  322  		opt->command = command;
f25c0515c52137 Arnd Bergmann  2021-10-26  323  		opt->handle = sch->handle;
f25c0515c52137 Arnd Bergmann  2021-10-26  324  		opt->parent = sch->parent;
8eb926feee9101 kwqcheii       2025-03-04  325  	}
f25c0515c52137 Arnd Bergmann  2021-10-26  326  
890d8d23ec3c9e Jakub Kicinski 2018-11-19  327  	if (command == TC_GRED_REPLACE) {
890d8d23ec3c9e Jakub Kicinski 2018-11-19  328  		unsigned int i;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  329  
f25c0515c52137 Arnd Bergmann  2021-10-26 @330  		opt->set.grio_on = gred_rio_mode(table);
f25c0515c52137 Arnd Bergmann  2021-10-26  331  		opt->set.wred_on = gred_wred_mode(table);
f25c0515c52137 Arnd Bergmann  2021-10-26  332  		opt->set.dp_cnt = table->DPs;
f25c0515c52137 Arnd Bergmann  2021-10-26  333  		opt->set.dp_def = table->def;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  334  
890d8d23ec3c9e Jakub Kicinski 2018-11-19  335  		for (i = 0; i < table->DPs; i++) {
890d8d23ec3c9e Jakub Kicinski 2018-11-19  336  			struct gred_sched_data *q = table->tab[i];
890d8d23ec3c9e Jakub Kicinski 2018-11-19  337  
890d8d23ec3c9e Jakub Kicinski 2018-11-19  338  			if (!q)
890d8d23ec3c9e Jakub Kicinski 2018-11-19  339  				continue;
f25c0515c52137 Arnd Bergmann  2021-10-26  340  			opt->set.tab[i].present = true;
f25c0515c52137 Arnd Bergmann  2021-10-26  341  			opt->set.tab[i].limit = q->limit;
f25c0515c52137 Arnd Bergmann  2021-10-26  342  			opt->set.tab[i].prio = q->prio;
f25c0515c52137 Arnd Bergmann  2021-10-26  343  			opt->set.tab[i].min = q->parms.qth_min >> q->parms.Wlog;
f25c0515c52137 Arnd Bergmann  2021-10-26  344  			opt->set.tab[i].max = q->parms.qth_max >> q->parms.Wlog;
f25c0515c52137 Arnd Bergmann  2021-10-26  345  			opt->set.tab[i].is_ecn = gred_use_ecn(q);
f25c0515c52137 Arnd Bergmann  2021-10-26  346  			opt->set.tab[i].is_harddrop = gred_use_harddrop(q);
f25c0515c52137 Arnd Bergmann  2021-10-26  347  			opt->set.tab[i].probability = q->parms.max_P;
f25c0515c52137 Arnd Bergmann  2021-10-26  348  			opt->set.tab[i].backlog = &q->backlog;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  349  		}
f25c0515c52137 Arnd Bergmann  2021-10-26  350  		opt->set.qstats = &sch->qstats;
890d8d23ec3c9e Jakub Kicinski 2018-11-19  351  	}
890d8d23ec3c9e Jakub Kicinski 2018-11-19  352  
f25c0515c52137 Arnd Bergmann  2021-10-26  353  	dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_GRED, opt);
890d8d23ec3c9e Jakub Kicinski 2018-11-19  354  }
890d8d23ec3c9e Jakub Kicinski 2018-11-19  355  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-03-07  1:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07  1:32 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-05 15:57 [PATCH] sched: address a potential NULL pointer dereference in the GRED scheduler Jun Yang
2025-02-27 16:04 kwqcheii
2025-02-27 18:26 ` Cong Wang
2025-03-04 14:18 ` kwqcheii
2025-03-04 20:05   ` Cong Wang
2025-03-05 15:44     ` Jun Yang
2025-03-05 18:22       ` Cong Wang
2025-03-07  0:50       ` patchwork-bot+netdevbpf

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=202503070956.I8Z06FRE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.