]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: fix static checker warning
authorPaulo Alcantara <pc@cjr.nz>
Fri, 14 Oct 2022 16:40:42 +0000 (13:40 -0300)
committerSteve French <stfrench@microsoft.com>
Fri, 14 Oct 2022 17:35:25 +0000 (12:35 -0500)
Remove unnecessary NULL check of oparam->cifs_sb when parsing symlink
error response as it's already set by all smb2_open_file() callers and
deferenced earlier.

This fixes below report:

  fs/cifs/smb2file.c:126 smb2_open_file()
  warn: variable dereferenced before check 'oparms->cifs_sb' (see line 112)

Link: https://lore.kernel.org/r/Y0kt42j2tdpYakRu@kili
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2file.c

index 4992b43616a7ab5ba4da596295778145a7165e04..ffbd9a99fc128634c6812651f1b9776a9727aeb4 100644 (file)
@@ -123,7 +123,7 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32
 
                if (unlikely(!err_iov.iov_base || err_buftype == CIFS_NO_BUFFER))
                        rc = -ENOMEM;
-               else if (hdr->Status == STATUS_STOPPED_ON_SYMLINK && oparms->cifs_sb) {
+               else if (hdr->Status == STATUS_STOPPED_ON_SYMLINK) {
                        rc = smb2_parse_symlink_response(oparms->cifs_sb, &err_iov,
                                                         &data->symlink_target);
                        if (!rc) {