From: Dan Carpenter <dan.carpenter@oracle.com>
To: pc@cjr.nz
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: improve symlink handling for smb2+
Date: Fri, 14 Oct 2022 12:37:39 +0300 [thread overview]
Message-ID: <Y0kt42j2tdpYakRu@kili> (raw)
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
next reply other threads:[~2022-10-14 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 9:37 Dan Carpenter [this message]
2022-10-14 16:40 ` [PATCH] cifs: fix static checker warning Paulo Alcantara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0kt42j2tdpYakRu@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@cjr.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox