Skip to content

Commit

Permalink
smb3: remove unneeded null check in cifs_readdir
Browse files Browse the repository at this point in the history
Coverity pointed out an unneeded check.

Addresses-Coverity: 1518030 ("Null pointer dereferences")
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Steve French committed May 27, 2022
1 parent de3a9e9 commit 44a4808
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/cifs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,8 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
* find_cifs_entry in case there will be reconnects during
* query_directory.
*/
if (cfid) {
close_cached_dir(cfid);
cfid = NULL;
}
close_cached_dir(cfid);
cfid = NULL;

cache_not_found:
/*
Expand Down
1 change: 1 addition & 0 deletions fs/cifs/smb2ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ smb2_cached_lease_break(struct work_struct *work)
/*
* Open the and cache a directory handle.
* Only supported for the root handle.
* If error then *cfid is not initialized.
*/
int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
const char *path,
Expand Down

0 comments on commit 44a4808

Please sign in to comment.