]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smb3: remove unneeded null check in cifs_readdir
authorSteve French <stfrench@microsoft.com>
Thu, 26 May 2022 04:56:07 +0000 (23:56 -0500)
committerSteve French <stfrench@microsoft.com>
Fri, 27 May 2022 17:05:47 +0000 (12:05 -0500)
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>
fs/cifs/readdir.c
fs/cifs/smb2ops.c

index ccf34481d801213dd3ed7911dc6f5dda883ebf56..384cabdf47caafab0404e1cf8150963d5db059ac 100644 (file)
@@ -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:
        /*
index 7e2c86e0cede8d8afed51585eee3f71f768d8541..d7ade739cde194e14b92d39674601c22071279e2 100644 (file)
@@ -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,