linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix warnings from CIFS on 2.5.61
@ 2003-02-17 22:49 Stephen Hemminger
  2003-02-18 13:07 ` Dave Kleikamp
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2003-02-17 22:49 UTC (permalink / raw)
  To: sfrench; +Cc: Linux Kernel Mailing List

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'

diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c	Mon Feb 17 14:16:15 2003
+++ b/fs/cifs/cifssmb.c	Mon Feb 17 14:16:15 2003
@@ -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;




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix warnings from CIFS on 2.5.61
  2003-02-17 22:49 [PATCH] Fix warnings from CIFS on 2.5.61 Stephen Hemminger
@ 2003-02-18 13:07 ` Dave Kleikamp
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Kleikamp @ 2003-02-18 13:07 UTC (permalink / raw)
  To: Stephen Hemminger, sfrench; +Cc: Linux Kernel Mailing List

On Monday 17 February 2003 16:49, Stephen Hemminger wrote:

> +	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.

-- 
David Kleikamp
IBM Linux Technology Center


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix warnings from CIFS on 2.5.61
@ 2003-02-18 19:26 Steven French
  0 siblings, 0 replies; 3+ messages in thread
From: Steven French @ 2003-02-18 19:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: sfrench, Linux Kernel Mailing List





Stephen Hemminger wrote:
>This patch gets rid of the following warnings.
>
>fs/cifs/cifssmb.c: In function `CIFSSMBRead':
>fs/cifs/cifssmb.c:489: warning: duplicate `const'

Your proposed patch is slightly better than what I had coded up to get rid
of the spurious gcc 3.2 warnings on the use of the min macro with const.  I
will include it as part of the next cifs update in the next few days.

Thanks.

Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench@us.ibm.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-18 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-17 22:49 [PATCH] Fix warnings from CIFS on 2.5.61 Stephen Hemminger
2003-02-18 13:07 ` Dave Kleikamp
2003-02-18 19:26 Steven French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).