[bug report] cifs: improve symlink handling for smb2+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Paulo Alcantara,

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

The patch d87ee26fa912: "cifs: improve symlink handling for smb2+"
from Oct 3, 2022, leads to the following Smatch complaint:

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

fs/cifs/smb2file.c
   111	
   112		smb2_path = cifs_convert_path_to_utf16(oparms->path, oparms->cifs_sb);
                                                                     ^^^^^^^^^^^^^^^
The existing code dereferences "oparms->cifs_sb" without checking for
NULL

   113		if (smb2_path == NULL)
   114			return -ENOMEM;
   115	
   116		oparms->desired_access |= FILE_READ_ATTRIBUTES;
   117		smb2_oplock = SMB2_OPLOCK_LEVEL_BATCH;
   118	
   119		rc = SMB2_open(xid, oparms, smb2_path, &smb2_oplock, smb2_data, NULL, &err_iov,
   120			       &err_buftype);
   121		if (rc && data) {
   122			struct smb2_hdr *hdr = err_iov.iov_base;
   123	
   124			if (unlikely(!err_iov.iov_base || err_buftype == CIFS_NO_BUFFER))
   125				rc = -ENOMEM;
   126			else if (hdr->Status == STATUS_STOPPED_ON_SYMLINK && oparms->cifs_sb) {
                                                                             ^^^^^^^^^^^^^^^
so presumably this new NULL check can be deleted as well.

   127				rc = smb2_parse_symlink_response(oparms->cifs_sb, &err_iov,
   128								 &data->symlink_target);

regards,
dan carpenter



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux