All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/most/core.c:1287 most_register_interface() error: we previously assumed 'iface' could be null (see line 1285)
@ 2020-06-01 19:53 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-06-01 19:53 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3756 bytes --]

Hi Christian,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
commit: b276527539188f1f61c082ebef27803db93e536d staging: most: move core files out of the staging area
date:   10 weeks ago

config: mips-randconfig-m031-20200601 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/most/core.c:1287 most_register_interface() error: we previously assumed 'iface' could be null (see line 1285)

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b276527539188f1f61c082ebef27803db93e536d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout b276527539188f1f61c082ebef27803db93e536d
vim +/iface +1287 drivers/most/core.c

4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1279  int most_register_interface(struct most_interface *iface)
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1280  {
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1281  	unsigned int i;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1282  	int id;
fcb7fad82e23f6 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1283  	struct most_channel *c;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1284  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24 @1285  	if (!iface || !iface->enqueue || !iface->configure ||
                                                                                                    ^^^^^^
Check for NULL.

57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1286  	    !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
6a82c775812944 drivers/staging/most/core.c          Christian Gromm     2020-01-23 @1287  		dev_err(iface->dev, "Bad interface or channel overflow\n");
                                                                                                                ^^^^^^^^^^
Dereference.  "iface" can't be NULL.  Just delete the check.

4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1288  		return -EINVAL;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1289  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1290  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1291  	id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1292  	if (id < 0) {
b7935e52dd9869 drivers/staging/most/core.c          Christian Gromm     2020-01-23  1293  		dev_err(iface->dev, "Failed to allocate device ID\n");
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1294  		return id;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1295  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1296  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27728 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* drivers/most/core.c:1287 most_register_interface() error: we previously assumed 'iface' could be null (see line 1285)
@ 2020-06-01 19:10 kbuild test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-06-01 19:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 14109 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Christian, Gromm," <christian.gromm@microchip.com>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>

Hi Christian,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
commit: b276527539188f1f61c082ebef27803db93e536d staging: most: move core files out of the staging area
date:   10 weeks ago
:::::: branch date: 19 hours ago
:::::: commit date: 10 weeks ago
config: mips-randconfig-m031-20200601 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/most/core.c:1287 most_register_interface() error: we previously assumed 'iface' could be null (see line 1285)

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b276527539188f1f61c082ebef27803db93e536d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout b276527539188f1f61c082ebef27803db93e536d
vim +/iface +1287 drivers/most/core.c

4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1271  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1272  /**
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1273   * most_register_interface - registers an interface with core
b7937dc41362f7 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1274   * @iface: device interface
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1275   *
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1276   * Allocates and initializes a new interface instance and all of its channels.
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1277   * Returns a pointer to kobject or an error pointer.
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1278   */
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1279  int most_register_interface(struct most_interface *iface)
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1280  {
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1281  	unsigned int i;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1282  	int id;
fcb7fad82e23f6 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1283  	struct most_channel *c;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1284  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24 @1285  	if (!iface || !iface->enqueue || !iface->configure ||
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1286  	    !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
6a82c775812944 drivers/staging/most/core.c          Christian Gromm     2020-01-23 @1287  		dev_err(iface->dev, "Bad interface or channel overflow\n");
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1288  		return -EINVAL;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1289  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1290  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1291  	id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1292  	if (id < 0) {
b7935e52dd9869 drivers/staging/most/core.c          Christian Gromm     2020-01-23  1293  		dev_err(iface->dev, "Failed to allocate device ID\n");
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1294  		return id;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1295  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1296  
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1297  	iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1298  	if (!iface->p) {
b7382d44a530cd drivers/staging/most/mostcore/core.c Christian Gromm     2015-12-22  1299  		ida_simple_remove(&mdev_id, id);
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1300  		return -ENOMEM;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1301  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1302  
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1303  	INIT_LIST_HEAD(&iface->p->channel_list);
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1304  	iface->p->dev_id = id;
3970d0d8181631 drivers/staging/most/core.c          Gustavo A. R. Silva 2019-04-22  1305  	strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
d693e90d897854 drivers/staging/most/core.c          Christian Gromm     2020-01-23  1306  	iface->dev->bus = &mostbus;
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1307  	iface->dev->groups = interface_attr_groups;
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1308  	dev_set_drvdata(iface->dev, iface);
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1309  	if (device_register(iface->dev)) {
b7935e52dd9869 drivers/staging/most/core.c          Christian Gromm     2020-01-23  1310  		dev_err(iface->dev, "Failed to register interface device\n");
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1311  		kfree(iface->p);
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1312  		put_device(iface->dev);
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1313  		ida_simple_remove(&mdev_id, id);
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1314  		return -ENOMEM;
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1315  	}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1316  
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1317  	for (i = 0; i < iface->num_channels; i++) {
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1318  		const char *name_suffix = iface->channel_vector[i].name_suffix;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1319  
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1320  		c = kzalloc(sizeof(*c), GFP_KERNEL);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1321  		if (!c)
bddd3c2546e9c4 drivers/staging/most/core.c          Christian Gromm     2018-09-21  1322  			goto err_free_resources;
845101bed86786 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1323  		if (!name_suffix)
845101bed86786 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1324  			snprintf(c->name, STRING_SIZE, "ch%d", i);
845101bed86786 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1325  		else
845101bed86786 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1326  			snprintf(c->name, STRING_SIZE, "%s", name_suffix);
845101bed86786 drivers/staging/most/core.c          Christian Gromm     2017-11-21  1327  		c->dev.init_name = c->name;
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1328  		c->dev.parent = iface->dev;
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1329  		c->dev.groups = channel_attr_groups;
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1330  		c->dev.release = release_channel;
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1331  		iface->p->channel[i] = c;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1332  		c->is_starving = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1333  		c->iface = iface;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1334  		c->channel_id = i;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1335  		c->keep_mbo = false;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1336  		c->enqueue_halt = false;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1337  		c->is_poisoned = false;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1338  		c->cfg.direction = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1339  		c->cfg.data_type = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1340  		c->cfg.num_buffers = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1341  		c->cfg.buffer_size = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1342  		c->cfg.subbuffer_size = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1343  		c->cfg.packets_per_xact = 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1344  		spin_lock_init(&c->fifo_lock);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1345  		INIT_LIST_HEAD(&c->fifo);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1346  		INIT_LIST_HEAD(&c->trash_fifo);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1347  		INIT_LIST_HEAD(&c->halt_fifo);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1348  		init_completion(&c->cleanup);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1349  		atomic_set(&c->mbo_ref, 0);
f13f6981bca3c7 drivers/staging/most/mostcore/core.c Christian Gromm     2015-09-28  1350  		mutex_init(&c->start_mutex);
bf9503f11dedf4 drivers/staging/most/mostcore/core.c Christian Gromm     2016-08-19  1351  		mutex_init(&c->nq_mutex);
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1352  		list_add_tail(&c->list, &iface->p->channel_list);
f0b4a22a484818 drivers/staging/most/core.c          Christian Gromm     2018-08-13  1353  		if (device_register(&c->dev)) {
b7935e52dd9869 drivers/staging/most/core.c          Christian Gromm     2020-01-23  1354  			dev_err(&c->dev, "Failed to register channel device\n");
bddd3c2546e9c4 drivers/staging/most/core.c          Christian Gromm     2018-09-21  1355  			goto err_free_most_channel;
f0b4a22a484818 drivers/staging/most/core.c          Christian Gromm     2018-08-13  1356  		}
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1357  	}
acdbb89753734f drivers/staging/most/core.c          Christian Gromm     2019-04-03  1358  	most_interface_register_notify(iface->description);
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1359  	return 0;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1360  
bddd3c2546e9c4 drivers/staging/most/core.c          Christian Gromm     2018-09-21  1361  err_free_most_channel:
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1362  	put_device(&c->dev);
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1363  
bddd3c2546e9c4 drivers/staging/most/core.c          Christian Gromm     2018-09-21  1364  err_free_resources:
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1365  	while (i > 0) {
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1366  		c = iface->p->channel[--i];
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1367  		device_unregister(&c->dev);
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1368  	}
9136fccf38a7aa drivers/staging/most/core.c          Christian Gromm     2017-11-21  1369  	kfree(iface->p);
723de0f9171eeb drivers/staging/most/core.c          Christian Gromm     2020-01-23  1370  	device_unregister(iface->dev);
b7382d44a530cd drivers/staging/most/mostcore/core.c Christian Gromm     2015-12-22  1371  	ida_simple_remove(&mdev_id, id);
4d5f022f3a664e drivers/staging/most/core.c          Christian Gromm     2017-11-21  1372  	return -ENOMEM;
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1373  }
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1374  EXPORT_SYMBOL_GPL(most_register_interface);
57562a72414ca3 drivers/staging/most/mostcore/core.c Christian Gromm     2015-07-24  1375  

:::::: The code at line 1287 was first introduced by commit
:::::: 6a82c7758129441e7450703e6887d6cde003ff85 staging: most: remove struct device core driver

:::::: TO: Christian Gromm <christian.gromm@microchip.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27728 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-01 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-01 19:53 drivers/most/core.c:1287 most_register_interface() error: we previously assumed 'iface' could be null (see line 1285) Dan Carpenter
2020-06-01 19:53 ` [kbuild] " Dan Carpenter
2020-06-01 19:53 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-06-01 19:10 kbuild test robot

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.