All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Dave Jiang <dave.jiang@intel.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: [djiang:cxl/features 11/15] drivers/cxl/core/mbox.c:775 cxl_walk_cel() error: we previously assumed 'cmd' could be null (see line 767)
Date: Fri, 13 Dec 2024 23:16:21 +0300	[thread overview]
Message-ID: <af36af30-76ef-48b7-8a1f-e670ba3bf7aa@stanley.mountain> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djiang/linux.git cxl/features
head:   f0a6d114e94c15c348733978c4dad4ecdae16d16
commit: 96d766b4e53edf0c9ef84fa447b7afe6fbeeb743 [11/15] cxl: Enumerate feature commands
config: i386-randconfig-141-20241213 (https://download.01.org/0day-ci/archive/20241214/202412140111.UkB1YSO2-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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 <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202412140111.UkB1YSO2-lkp@intel.com/

smatch warnings:
drivers/cxl/core/mbox.c:775 cxl_walk_cel() error: we previously assumed 'cmd' could be null (see line 767)

vim +/cmd +775 drivers/cxl/core/mbox.c

59f8d1510739e92 Dan Williams     2023-06-14  752  static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel)
4faf31b43468c58 Dan Williams     2021-09-08  753  {
e624d105c460e56 Dave Jiang       2024-06-17  754  	struct cxl_mailbox *cxl_mbox = &mds->cxlds.cxl_mbox;
49be6dd807511db Dan Williams     2021-09-08  755  	struct cxl_cel_entry *cel_entry;
4faf31b43468c58 Dan Williams     2021-09-08  756  	const int cel_entries = size / sizeof(*cel_entry);
59f8d1510739e92 Dan Williams     2023-06-14  757  	struct device *dev = mds->cxlds.dev;
4faf31b43468c58 Dan Williams     2021-09-08  758  	int i;
4faf31b43468c58 Dan Williams     2021-09-08  759  
49be6dd807511db Dan Williams     2021-09-08  760  	cel_entry = (struct cxl_cel_entry *) cel;
4faf31b43468c58 Dan Williams     2021-09-08  761  
4faf31b43468c58 Dan Williams     2021-09-08  762  	for (i = 0; i < cel_entries; i++) {
4faf31b43468c58 Dan Williams     2021-09-08  763  		u16 opcode = le16_to_cpu(cel_entry[i].opcode);
4faf31b43468c58 Dan Williams     2021-09-08  764  		struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
d2f706058826b80 Ira Weiny        2023-09-03  765  		int enabled = 0;
4faf31b43468c58 Dan Williams     2021-09-08  766  
d2f706058826b80 Ira Weiny        2023-09-03 @767  		if (cmd) {
                                                                    ^^^
NULL check

e624d105c460e56 Dave Jiang       2024-06-17  768  			set_bit(cmd->info.id, cxl_mbox->enabled_cmds);
d2f706058826b80 Ira Weiny        2023-09-03  769  			enabled++;
96d766b4e53edf0 Dave Jiang       2024-12-11  770  		} else {
96d766b4e53edf0 Dave Jiang       2024-12-11  771  			struct cxl_mem_command *fcmd =
96d766b4e53edf0 Dave Jiang       2024-12-11  772  				cxl_find_feature_command(opcode);
96d766b4e53edf0 Dave Jiang       2024-12-11  773  
96d766b4e53edf0 Dave Jiang       2024-12-11  774  			if (fcmd) {
96d766b4e53edf0 Dave Jiang       2024-12-11 @775  				set_bit(cmd->info.id, cxl_mbox->feature_cmds);
                                                                                        ^^^^^
was fcmd, intended here?

96d766b4e53edf0 Dave Jiang       2024-12-11  776  				enabled++;
96d766b4e53edf0 Dave Jiang       2024-12-11  777  			}
d2f706058826b80 Ira Weiny        2023-09-03  778  		}
d0abf5787adc034 Alison Schofield 2023-04-18  779  
d2f706058826b80 Ira Weiny        2023-09-03  780  		if (cxl_is_poison_command(opcode)) {
59f8d1510739e92 Dan Williams     2023-06-14  781  			cxl_set_poison_cmd_enabled(&mds->poison, opcode);
d2f706058826b80 Ira Weiny        2023-09-03  782  			enabled++;
d2f706058826b80 Ira Weiny        2023-09-03  783  		}
d0abf5787adc034 Alison Schofield 2023-04-18  784  
d2f706058826b80 Ira Weiny        2023-09-03  785  		if (cxl_is_security_command(opcode)) {
ad64f5952ce3ea5 Davidlohr Bueso  2023-07-25  786  			cxl_set_security_cmd_enabled(&mds->security, opcode);
d2f706058826b80 Ira Weiny        2023-09-03  787  			enabled++;
d2f706058826b80 Ira Weiny        2023-09-03  788  		}
ad64f5952ce3ea5 Davidlohr Bueso  2023-07-25  789  
d2f706058826b80 Ira Weiny        2023-09-03  790  		dev_dbg(dev, "Opcode 0x%04x %s\n", opcode,
d2f706058826b80 Ira Weiny        2023-09-03  791  			enabled ? "enabled" : "unsupported by driver");
4faf31b43468c58 Dan Williams     2021-09-08  792  	}
4faf31b43468c58 Dan Williams     2021-09-08  793  }

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


             reply	other threads:[~2024-12-13 20:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 20:16 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-13 17:51 [djiang:cxl/features 11/15] drivers/cxl/core/mbox.c:775 cxl_walk_cel() error: we previously assumed 'cmd' could be null (see line 767) kernel test robot

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=af36af30-76ef-48b7-8a1f-e670ba3bf7aa@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=dave.jiang@intel.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --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.