* drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226)
@ 2026-08-07 16:55 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-08-07 14:39 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Eli Billauer <eli.billauer@gmail.com>
CC: 0day robot <lkp@intel.com>
tree: https://github.com/intel-lab-lkp/linux/commits/Eli-Billauer/char-xillybus-Improve-control-of-execution-flow-with-mutexes/20260806-033404
head: d05c024c9354aabd2ea64be46e6fccbf24ba33cd
commit: 16edb90c39a5645b3803be32b2b77476efae2402 char: xillybus: Add defensive sanity checks
date: 2 days ago
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260807/202608072246.Ee6OOcT6-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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/202608072246.Ee6OOcT6-lkp@intel.com/
smatch warnings:
drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226)
vim +/inode +230 drivers/char/xillybus/xillybus_class.c
8cb5d216ab3365 Eli Billauer 2021-05-26 222
8cb5d216ab3365 Eli Billauer 2021-05-26 223 int xillybus_find_inode(struct inode *inode,
8cb5d216ab3365 Eli Billauer 2021-05-26 224 void **private_data, int *index)
8cb5d216ab3365 Eli Billauer 2021-05-26 225 {
8cb5d216ab3365 Eli Billauer 2021-05-26 @226 int minor = iminor(inode);
8cb5d216ab3365 Eli Billauer 2021-05-26 227 int major = imajor(inode);
4834f9898c7301 Jakob Koschel 2022-03-24 228 struct xilly_unit *unit = NULL, *iter;
8cb5d216ab3365 Eli Billauer 2021-05-26 229
16edb90c39a564 Eli Billauer 2026-06-30 @230 if (!inode || !private_data || !index)
16edb90c39a564 Eli Billauer 2026-06-30 231 return -ENODEV;
16edb90c39a564 Eli Billauer 2026-06-30 232
8cb5d216ab3365 Eli Billauer 2021-05-26 233 mutex_lock(&unit_mutex);
8cb5d216ab3365 Eli Billauer 2021-05-26 234
4834f9898c7301 Jakob Koschel 2022-03-24 235 list_for_each_entry(iter, &unit_list, list_entry)
4834f9898c7301 Jakob Koschel 2022-03-24 236 if (iter->major == major &&
4834f9898c7301 Jakob Koschel 2022-03-24 237 minor >= iter->lowest_minor &&
4834f9898c7301 Jakob Koschel 2022-03-24 238 minor < (iter->lowest_minor + iter->num_nodes)) {
4834f9898c7301 Jakob Koschel 2022-03-24 239 unit = iter;
8cb5d216ab3365 Eli Billauer 2021-05-26 240 break;
8cb5d216ab3365 Eli Billauer 2021-05-26 241 }
8cb5d216ab3365 Eli Billauer 2021-05-26 242
c002f04c0bc79e Eli Billauer 2022-11-17 243 if (!unit) {
8cb5d216ab3365 Eli Billauer 2021-05-26 244 mutex_unlock(&unit_mutex);
8cb5d216ab3365 Eli Billauer 2021-05-26 245 return -ENODEV;
c002f04c0bc79e Eli Billauer 2022-11-17 246 }
8cb5d216ab3365 Eli Billauer 2021-05-26 247
8cb5d216ab3365 Eli Billauer 2021-05-26 248 *private_data = unit->private_data;
8cb5d216ab3365 Eli Billauer 2021-05-26 249 *index = minor - unit->lowest_minor;
8cb5d216ab3365 Eli Billauer 2021-05-26 250
c002f04c0bc79e Eli Billauer 2022-11-17 251 mutex_unlock(&unit_mutex);
8cb5d216ab3365 Eli Billauer 2021-05-26 252 return 0;
8cb5d216ab3365 Eli Billauer 2021-05-26 253 }
8cb5d216ab3365 Eli Billauer 2021-05-26 254 EXPORT_SYMBOL(xillybus_find_inode);
8cb5d216ab3365 Eli Billauer 2021-05-26 255
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226)
@ 2026-08-07 16:55 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-08-07 16:55 UTC (permalink / raw)
To: oe-kbuild, Eli Billauer; +Cc: lkp, oe-kbuild-all
tree: https://github.com/intel-lab-lkp/linux/commits/Eli-Billauer/char-xillybus-Improve-control-of-execution-flow-with-mutexes/20260806-033404
head: d05c024c9354aabd2ea64be46e6fccbf24ba33cd
commit: 16edb90c39a5645b3803be32b2b77476efae2402 char: xillybus: Add defensive sanity checks
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260807/202608072246.Ee6OOcT6-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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/202608072246.Ee6OOcT6-lkp@intel.com/
smatch warnings:
drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226)
vim +/inode +230 drivers/char/xillybus/xillybus_class.c
8cb5d216ab3365 Eli Billauer 2021-05-26 223 int xillybus_find_inode(struct inode *inode,
8cb5d216ab3365 Eli Billauer 2021-05-26 224 void **private_data, int *index)
8cb5d216ab3365 Eli Billauer 2021-05-26 225 {
8cb5d216ab3365 Eli Billauer 2021-05-26 @226 int minor = iminor(inode);
8cb5d216ab3365 Eli Billauer 2021-05-26 227 int major = imajor(inode);
^^^^^
Unchecked dereferences
4834f9898c7301 Jakob Koschel 2022-03-24 228 struct xilly_unit *unit = NULL, *iter;
8cb5d216ab3365 Eli Billauer 2021-05-26 229
16edb90c39a564 Eli Billauer 2026-06-30 @230 if (!inode || !private_data || !index)
^^^^^^
Checked too late.
16edb90c39a564 Eli Billauer 2026-06-30 231 return -ENODEV;
16edb90c39a564 Eli Billauer 2026-06-30 232
8cb5d216ab3365 Eli Billauer 2021-05-26 233 mutex_lock(&unit_mutex);
8cb5d216ab3365 Eli Billauer 2021-05-26 234
4834f9898c7301 Jakob Koschel 2022-03-24 235 list_for_each_entry(iter, &unit_list, list_entry)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226)
2026-08-07 16:55 ` Dan Carpenter
(?)
@ 2026-08-08 7:35 ` Eli Billauer
-1 siblings, 0 replies; 3+ messages in thread
From: Eli Billauer @ 2026-08-08 7:35 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all
Hello,
Thanks. The warning is correct, and applies to the first version of the
patch set referred to. This was however corrected a couple of weeks ago
in v2:
https://lore.kernel.org/all/20260722102307.49090-1-eli.billauer@gmail.com/T/#m2d3b975e15a454ef4455e6b28fc7cc905dcdbc2d
Regards,
Eli
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-08 7:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 14:39 drivers/char/xillybus/xillybus_class.c:230 xillybus_find_inode() warn: variable dereferenced before check 'inode' (see line 226) kernel test robot
2026-08-07 16:55 ` Dan Carpenter
2026-08-08 7:35 ` Eli Billauer
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.