diff options
author | David Howells <dhowells@redhat.com> | 2019-06-20 13:12:16 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-06-20 13:12:16 -0400 |
commit | fa59f52f5b1412c373813e24e7cbe5ab44518ed8 (patch) | |
tree | 5d6226d6d4fbb25e202e391a9d722cdf5c41dcaa | |
parent | 2cd42d19cffa0ec3dfb57b1b3e1a07a9bf4ed80a (diff) |
afs: afs_unlink() doesn't need to check dentry->d_inode
Don't check that dentry->d_inode is valid in afs_unlink(). We should be
able to take that as given.
This caused Smatch to issue the following warning:
fs/afs/dir.c:1392 afs_unlink() error: we previously assumed 'vnode' could be null (see line 1375)
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | fs/afs/dir.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 79d93a26759a..93fd51c3bdae 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -1394,7 +1394,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) | |||
1394 | { | 1394 | { |
1395 | struct afs_fs_cursor fc; | 1395 | struct afs_fs_cursor fc; |
1396 | struct afs_status_cb *scb; | 1396 | struct afs_status_cb *scb; |
1397 | struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL; | 1397 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
1398 | struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); | ||
1398 | struct key *key; | 1399 | struct key *key; |
1399 | bool need_rehash = false; | 1400 | bool need_rehash = false; |
1400 | int ret; | 1401 | int ret; |
@@ -1417,15 +1418,12 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) | |||
1417 | } | 1418 | } |
1418 | 1419 | ||
1419 | /* Try to make sure we have a callback promise on the victim. */ | 1420 | /* Try to make sure we have a callback promise on the victim. */ |
1420 | if (d_really_is_positive(dentry)) { | 1421 | ret = afs_validate(vnode, key); |
1421 | vnode = AFS_FS_I(d_inode(dentry)); | 1422 | if (ret < 0) |
1422 | ret = afs_validate(vnode, key); | 1423 | goto error_key; |
1423 | if (ret < 0) | ||
1424 | goto error_key; | ||
1425 | } | ||
1426 | 1424 | ||
1427 | spin_lock(&dentry->d_lock); | 1425 | spin_lock(&dentry->d_lock); |
1428 | if (vnode && d_count(dentry) > 1) { | 1426 | if (d_count(dentry) > 1) { |
1429 | spin_unlock(&dentry->d_lock); | 1427 | spin_unlock(&dentry->d_lock); |
1430 | /* Start asynchronous writeout of the inode */ | 1428 | /* Start asynchronous writeout of the inode */ |
1431 | write_inode_now(d_inode(dentry), 0); | 1429 | write_inode_now(d_inode(dentry), 0); |