Commit f0d3868b authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: clean up indentation in CIFSSMBQAllEAs

Add a label that we can goto on error, and reduce some of the
if/then/else indentation in this function.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 370b4191
...@@ -5282,9 +5282,10 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -5282,9 +5282,10 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
int rc = 0; int rc = 0;
int bytes_returned; int bytes_returned;
int name_len; int name_len;
struct fealist *ea_response_data;
struct fea *temp_fea; struct fea *temp_fea;
char *temp_ptr; char *temp_ptr;
__u16 params, byte_count; __u16 params, byte_count, data_offset;
cFYI(1, ("In Query All EAs path %s", searchName)); cFYI(1, ("In Query All EAs path %s", searchName));
QAllEAsRetry: QAllEAsRetry:
...@@ -5334,38 +5335,39 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -5334,38 +5335,39 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) { if (rc) {
cFYI(1, ("Send error in QueryAllEAs = %d", rc)); cFYI(1, ("Send error in QueryAllEAs = %d", rc));
} else { /* decode response */ goto QAllEAsOut;
rc = validate_t2((struct smb_t2_rsp *)pSMBr); }
/* BB also check enough total bytes returned */ /* BB also check enough total bytes returned */
/* BB we need to improve the validity checking /* BB we need to improve the validity checking
of these trans2 responses */ of these trans2 responses */
if (rc || (pSMBr->ByteCount < 4))
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
if (rc || (pSMBr->ByteCount < 4)) {
rc = -EIO; /* bad smb */ rc = -EIO; /* bad smb */
/* else if (pFindData){ goto QAllEAsOut;
memcpy((char *) pFindData, }
(char *) &pSMBr->hdr.Protocol +
data_offset, kl);
}*/ else {
/* check that length of list is not more than bcc */ /* check that length of list is not more than bcc */
/* check that each entry does not go beyond length /* check that each entry does not go beyond length
of list */ of list */
/* check that each element of each entry does not /* check that each element of each entry does not
go beyond end of list */ go beyond end of list */
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
struct fealist *ea_response_data;
rc = 0;
/* validate_trans2_offsets() */ /* validate_trans2_offsets() */
/* BB check if start of smb + data_offset > &bcc+ bcc */ /* BB check if start of smb + data_offset > &bcc+ bcc */
data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
ea_response_data = (struct fealist *) ea_response_data = (struct fealist *)
(((char *) &pSMBr->hdr.Protocol) + (((char *) &pSMBr->hdr.Protocol) + data_offset);
data_offset);
name_len = le32_to_cpu(ea_response_data->list_len); name_len = le32_to_cpu(ea_response_data->list_len);
cFYI(1, ("ea length %d", name_len)); cFYI(1, ("ea length %d", name_len));
if (name_len <= 8) { if (name_len <= 8) {
/* returned EA size zeroed at top of function */
cFYI(1, ("empty EA list returned from server")); cFYI(1, ("empty EA list returned from server"));
} else { goto QAllEAsOut;
}
/* account for ea list len */ /* account for ea list len */
name_len -= 4; name_len -= 4;
temp_fea = ea_response_data->list; temp_fea = ea_response_data->list;
...@@ -5377,11 +5379,10 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -5377,11 +5379,10 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
rc += temp_fea->name_len; rc += temp_fea->name_len;
/* account for prefix user. and trailing null */ /* account for prefix user. and trailing null */
rc = rc + 5 + 1; rc = rc + 5 + 1;
if (rc < (int)buf_size) { if (rc < (int) buf_size) {
memcpy(EAData, "user.", 5); memcpy(EAData, "user.", 5);
EAData += 5; EAData += 5;
memcpy(EAData, temp_ptr, memcpy(EAData, temp_ptr, temp_fea->name_len);
temp_fea->name_len);
EAData += temp_fea->name_len; EAData += temp_fea->name_len;
/* null terminate name */ /* null terminate name */
*EAData = 0; *EAData = 0;
...@@ -5398,8 +5399,7 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -5398,8 +5399,7 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
/* account for trailing null */ /* account for trailing null */
name_len--; name_len--;
temp_ptr++; temp_ptr++;
value_len = value_len = le16_to_cpu(temp_fea->value_len);
le16_to_cpu(temp_fea->value_len);
name_len -= value_len; name_len -= value_len;
temp_ptr += value_len; temp_ptr += value_len;
/* BB check that temp_ptr is still /* BB check that temp_ptr is still
...@@ -5410,9 +5410,8 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -5410,9 +5410,8 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
/* go on to next EA */ /* go on to next EA */
temp_fea = (struct fea *)temp_ptr; temp_fea = (struct fea *)temp_ptr;
} }
}
} QAllEAsOut:
}
cifs_buf_release(pSMB); cifs_buf_release(pSMB);
if (rc == -EAGAIN) if (rc == -EAGAIN)
goto QAllEAsRetry; goto QAllEAsRetry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment