Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [bug report] cifs: improve symlink handling for smb2+
@ 2022-10-14  9:37 Dan Carpenter
  2022-10-14 16:40 ` [PATCH] cifs: fix static checker warning Paulo Alcantara
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-10-14  9:37 UTC (permalink / raw)
  To: pc; +Cc: linux-cifs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-14 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-14  9:37 [bug report] cifs: improve symlink handling for smb2+ Dan Carpenter
2022-10-14 16:40 ` [PATCH] cifs: fix static checker warning Paulo Alcantara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox