linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Cristian Marussi <cristian.marussi@arm.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Sudeep Holla <sudeep.holla@arm.com>
Subject: [linux-next:master 7267/7959] drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable dereferenced before check 'i' (see line 1210)
Date: Tue, 3 May 2022 11:30:07 +0300	[thread overview]
Message-ID: <202204300741.1Vg3IhCp-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5469f0c06732a077c70a759a81f2a1f00b277694
commit: 36b6ea0fc6bcbc618fe20d33a3b529a6d0653d99 [7267/7959] firmware: arm_scmi: Add iterators for multi-part commands
config: arm64-randconfig-m031-20220429 (https://download.01.org/0day-ci/archive/20220430/202204300741.1Vg3IhCp-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.3.0

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

smatch warnings:
drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable dereferenced before check 'i' (see line 1210)

vim +/i +1214 drivers/firmware/arm_scmi/driver.c

36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1205  static int scmi_iterator_run(void *iter)
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1206  {
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1207  	int ret = -EINVAL;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1208  	struct scmi_iterator *i = iter;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1209  	struct scmi_iterator_state *st = &i->state;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30 @1210  	struct scmi_iterator_ops *iops = i->ops;
                                                                                         ^^^^^^^
Dereference

36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1211  	const struct scmi_protocol_handle *ph = i->ph;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1212  	const struct scmi_xfer_ops *xops = ph->xops;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1213  
36b6ea0fc6bcbc Cristian Marussi 2022-03-30 @1214  	if (!i)
                                                            ^^^
Checked too late

36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1215  		return ret;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1216  
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1217  	do {
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1218  		iops->prepare_message(i->msg, st->desc_index, i->priv);
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1219  		ret = xops->do_xfer(ph, i->t);
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1220  		if (ret)
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1221  			break;
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1222  
36b6ea0fc6bcbc Cristian Marussi 2022-03-30  1223  		ret = iops->update_state(st, i->resp, i->priv);

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



                 reply	other threads:[~2022-05-03  8:30 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=202204300741.1Vg3IhCp-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=cristian.marussi@arm.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=sudeep.holla@arm.com \
    /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