Skip to contentSkip to conversation

Fix warnings from CIFS on 2.5.61

PATCH In review Stephen Hemminger 2 participants 2 messages Feb 17, 2003 – Feb 18, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix warnings from CIFS on 2.5.61

This patch gets rid of the following warnings.

fs/cifs/cifssmb.c: In function `CIFSSMBRead':
fs/cifs/cifssmb.c:489: warning: duplicate const' fs/cifs/cifssmb.c: In function CIFSSMBUnixQuerySymLink':
fs/cifs/cifssmb.c:1030: warning: duplicate const' fs/cifs/cifssmb.c:1044: warning: duplicate const' fs/cifs/cifssmb.c: In function `CIFSSMBQueryReparseLinkInfo':
fs/cifs/cifssmb.c:1120: warning: duplicate `const'

fs/cifs/cifssmb.c +13 -10
diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
@@ -504,9 +504,10 @@
 	pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF);
 	pSMB->OffsetHigh = cpu_to_le32(lseek >> 32);
 	pSMB->Remaining = 0;
-	pSMB->MaxCount = cpu_to_le16(min(count,
-					 (tcon->ses->server->maxBuf -
-					  MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
+	pSMB->MaxCount = cpu_to_le16(min_t(const int, 
+					   count,
+					   (tcon->ses->server->maxBuf -
+					    MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
 	pSMB->MaxCountHigh = 0;
 	pSMB->ByteCount = 0;  /* no need to do le conversion since it is 0 */
 
@@ -1045,9 +1046,10 @@
 								   Protocol +
 								   pSMBr->
 								   DataOffset),
-						      min(buflen,
-							  (int) pSMBr->
-							  DataCount) / 2);
+						      min_t(const int,
+							    buflen,
+							    pSMBr->
+							    DataCount) / 2);
 				cifs_strfromUCS_le(symlinkinfo,
 						   (wchar_t *) ((char *)
 								&pSMBr->
@@ -1059,9 +1061,9 @@
 			} else {
 				strncpy(symlinkinfo,
 					(char *) &pSMBr->hdr.Protocol +
-					pSMBr->DataOffset, min(buflen, (int)
-							       pSMBr->
-							       DataCount));
+					pSMBr->DataOffset, 
+					min_t(const int,
+						buflen,pSMBr->DataCount));
 			}
 			symlinkinfo[buflen] = 0;
 	/* just in case so calling code does not go off the end of buffer */
@@ -1137,7 +1139,8 @@
 				} else { /* ASCII names */
 					strncpy(symlinkinfo,reparse_buf->LinkNamesBuf + 
 						reparse_buf->TargetNameOffset, 
-						min(buflen, (int)reparse_buf->TargetNameLen));
+						min_t(const int,
+						      buflen, reparse_buf->TargetNameLen));
 				}
 			} else {
 				rc = -EIO;
#1 lore raw

fs/cifs/cifssmb.c line 510

Quoted 4 lines · Stephen Hemminger
fs/cifs/cifssmb.c +4 -0
+	pSMB->MaxCount = cpu_to_le16(min_t(const int,
+					   count,
+					   (tcon->ses->server->maxBuf -
+					    MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));

The type here should be const unsigned int. Both count and maxBuf are unsigned.

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center