Skip to contentSkip to conversation

IB/ipath: sysfs and ipathfs support for core driver

DISCUSSION Dan Carpenter 1 participant 1 message Jul 8, 2014 InfiniBand

lore
Share & tools
lore
#0 lore raw

Hello Bryan O'Sullivan,

This is a semi-automatic email about new static checker warnings.

The patch 3e9b4a5eb4ae: "IB/ipath: sysfs and ipathfs support for core driver" from Mar 29, 2006, leads to the following Smatch complaint:

drivers/infiniband/hw/ipath/ipath_fs.c:285 remove_file()

	 error: we previously assumed 'tmp->d_inode' could be null (see line 281)

drivers/infiniband/hw/ipath/ipath_fs.c
280 spin_lock(&tmp->d_lock);

   281		if (!(d_unhashed(tmp) && tmp->d_inode)) {
                                         ^^^^^^^^^^^^

We allow that ->d_inode to be NULL.

282 dget_dlock(tmp);
283 __d_drop(tmp);
284 spin_unlock(&tmp->d_lock);

   285			simple_unlink(parent->d_inode, tmp);
                                                       ^^^

But we dereference it inside the call to simple_unlink(). This code is probably cut-and-pasted from configfs because I reported a bug in that code as well yesterday but haven't heard back.

   286		} else
   287			spin_unlock(&tmp->d_lock);

drivers/infiniband/hw/qib/qib_fs.c
458 spin_lock(&tmp->d_lock);

   459          if (!(d_unhashed(tmp) && tmp->d_inode)) {
                                         ^^^^^^^^^^^^
   460                  __d_drop(tmp);
   461                  spin_unlock(&tmp->d_lock);
   462                  simple_unlink(parent->d_inode, tmp);
                                                       ^^^

And another one here in qib_fs.c.

   463          } else {
   464                  spin_unlock(&tmp->d_lock);

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html