aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-26 09:55:29 -0400
committerSteve French <sfrench@us.ibm.com>2012-03-31 18:31:25 -0400
commitb2a3ad9ca502169fc4c11296fa20f56059c7c031 (patch)
tree3375266c2486554f5b1f1a9f18fd7a5f8880b312 /fs/cifs/cifssmb.c
parentb5efb978469d152c2c7c0a09746fb0bfc6171868 (diff)
cifs: silence compiler warnings showing up with gcc-4.7.0
gcc-4.7.0 has started throwing these warnings when building cifs.ko. CC [M] fs/cifs/cifssmb.o fs/cifs/cifssmb.c: In function ‘CIFSSMBSetCIFSACL’: fs/cifs/cifssmb.c:3905:9: warning: array subscript is above array bounds [-Warray-bounds] fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileInfo’: fs/cifs/cifssmb.c:5711:8: warning: array subscript is above array bounds [-Warray-bounds] fs/cifs/cifssmb.c: In function ‘CIFSSMBUnixSetFileInfo’: fs/cifs/cifssmb.c:6001:25: warning: array subscript is above array bounds [-Warray-bounds] This patch cleans up the code a bit by using the offsetof macro instead of the funky "&pSMB->hdr.Protocol" construct. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 8fecc99be344..f52c5ab78f9d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3892,13 +3892,12 @@ CIFSSMBSetCIFSACL(const int xid, struct cifs_tcon *tcon, __u16 fid,
3892 int rc = 0; 3892 int rc = 0;
3893 int bytes_returned = 0; 3893 int bytes_returned = 0;
3894 SET_SEC_DESC_REQ *pSMB = NULL; 3894 SET_SEC_DESC_REQ *pSMB = NULL;
3895 NTRANSACT_RSP *pSMBr = NULL; 3895 void *pSMBr;
3896 3896
3897setCifsAclRetry: 3897setCifsAclRetry:
3898 rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, 3898 rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr);
3899 (void **) &pSMBr);
3900 if (rc) 3899 if (rc)
3901 return (rc); 3900 return rc;
3902 3901
3903 pSMB->MaxSetupCount = 0; 3902 pSMB->MaxSetupCount = 0;
3904 pSMB->Reserved = 0; 3903 pSMB->Reserved = 0;
@@ -3926,9 +3925,8 @@ setCifsAclRetry:
3926 pSMB->AclFlags = cpu_to_le32(aclflag); 3925 pSMB->AclFlags = cpu_to_le32(aclflag);
3927 3926
3928 if (pntsd && acllen) { 3927 if (pntsd && acllen) {
3929 memcpy((char *) &pSMBr->hdr.Protocol + data_offset, 3928 memcpy((char *)pSMBr + offsetof(struct smb_hdr, Protocol) +
3930 (char *) pntsd, 3929 data_offset, pntsd, acllen);
3931 acllen);
3932 inc_rfc1001_len(pSMB, byte_count + data_count); 3930 inc_rfc1001_len(pSMB, byte_count + data_count);
3933 } else 3931 } else
3934 inc_rfc1001_len(pSMB, byte_count); 3932 inc_rfc1001_len(pSMB, byte_count);
@@ -5708,7 +5706,8 @@ CIFSSMBSetFileInfo(const int xid, struct cifs_tcon *tcon,
5708 param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; 5706 param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4;
5709 offset = param_offset + params; 5707 offset = param_offset + params;
5710 5708
5711 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 5709 data_offset = (char *)pSMB +
5710 offsetof(struct smb_hdr, Protocol) + offset;
5712 5711
5713 count = sizeof(FILE_BASIC_INFO); 5712 count = sizeof(FILE_BASIC_INFO);
5714 pSMB->MaxParameterCount = cpu_to_le16(2); 5713 pSMB->MaxParameterCount = cpu_to_le16(2);
@@ -5977,7 +5976,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon,
5977 u16 fid, u32 pid_of_opener) 5976 u16 fid, u32 pid_of_opener)
5978{ 5977{
5979 struct smb_com_transaction2_sfi_req *pSMB = NULL; 5978 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5980 FILE_UNIX_BASIC_INFO *data_offset; 5979 char *data_offset;
5981 int rc = 0; 5980 int rc = 0;
5982 u16 params, param_offset, offset, byte_count, count; 5981 u16 params, param_offset, offset, byte_count, count;
5983 5982
@@ -5999,8 +5998,9 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon,
5999 param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; 5998 param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4;
6000 offset = param_offset + params; 5999 offset = param_offset + params;
6001 6000
6002 data_offset = (FILE_UNIX_BASIC_INFO *) 6001 data_offset = (char *)pSMB +
6003 ((char *)(&pSMB->hdr.Protocol) + offset); 6002 offsetof(struct smb_hdr, Protocol) + offset;
6003
6004 count = sizeof(FILE_UNIX_BASIC_INFO); 6004 count = sizeof(FILE_UNIX_BASIC_INFO);
6005 6005
6006 pSMB->MaxParameterCount = cpu_to_le16(2); 6006 pSMB->MaxParameterCount = cpu_to_le16(2);
@@ -6022,7 +6022,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon,
6022 inc_rfc1001_len(pSMB, byte_count); 6022 inc_rfc1001_len(pSMB, byte_count);
6023 pSMB->ByteCount = cpu_to_le16(byte_count); 6023 pSMB->ByteCount = cpu_to_le16(byte_count);
6024 6024
6025 cifs_fill_unix_set_info(data_offset, args); 6025 cifs_fill_unix_set_info((FILE_UNIX_BASIC_INFO *)data_offset, args);
6026 6026
6027 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); 6027 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
6028 if (rc) 6028 if (rc)