summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2021-07-02 04:01:19 +0200
committerSteve French <stfrench@microsoft.com>2021-07-03 01:36:26 +0200
commitb019e1187ce4bb1f120cbea1a412d8aadb499260 (patch)
tree513e2217b11f7862e2c6e5bf50b1286f76461b4d /fs
parentCIFS: Clarify SMB1 code for UnixCreateSymLink (diff)
downloadlinux-b019e1187ce4bb1f120cbea1a412d8aadb499260.tar.xz
linux-b019e1187ce4bb1f120cbea1a412d8aadb499260.zip
CIFS: Clarify SMB1 code for UnixSetPathInfo
Coverity also complains about the way we calculate the offset (starting from the address of a 4 byte array within the header structure rather than from the beginning of the struct plus 4 bytes) for doing SetPathInfo (setattr) when using the Unix extensions. This doesn't change the address but makes it slightly clearer. Addresses-Coverity: 711528 ("Out of bounds read") Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifssmb.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a14d3f533301..22b8c12962fa 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -6064,9 +6064,8 @@ setPermsRetry:
param_offset = offsetof(struct smb_com_transaction2_spi_req,
InformationLevel) - 4;
offset = param_offset + params;
- data_offset =
- (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
- offset);
+ /* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */
+ data_offset = (FILE_UNIX_BASIC_INFO *)((char *) pSMB + offset + 4);
memset(data_offset, 0, count);
pSMB->DataOffset = cpu_to_le16(offset);
pSMB->ParameterOffset = cpu_to_le16(param_offset);