From ce1e78cde1ed573a37b82cd9811cb913df31a0ba Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Tue, 21 Sep 2004 02:47:01 -0700 Subject: [PATCH] [PATCH] cifs: annotate NEGOTIATE_{REQ,RESP} Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/cifs/cifspdu.h | 22 +++++++++++----------- fs/cifs/cifssmb.c | 9 +++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 48579b875a1fe..b25d21e876d97 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h @@ -373,23 +373,23 @@ struct smb_hdr { typedef struct negotiate_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; unsigned char DialectsArray[1]; } NEGOTIATE_REQ; typedef struct negotiate_rsp { struct smb_hdr hdr; /* wct = 17 */ - __u16 DialectIndex; + __le16 DialectIndex; __u8 SecurityMode; - __u16 MaxMpxCount; - __u16 MaxNumberVcs; - __u32 MaxBufferSize; - __u32 MaxRawSize; - __u32 SessionKey; - __u32 Capabilities; /* see below */ - __u32 SystemTimeLow; - __u32 SystemTimeHigh; - __u16 ServerTimeZone; + __le16 MaxMpxCount; + __le16 MaxNumberVcs; + __le32 MaxBufferSize; + __le32 MaxRawSize; + __le32 SessionKey; + __le32 Capabilities; /* see below */ + __le32 SystemTimeLow; + __le32 SystemTimeHigh; + __le16 ServerTimeZone; __u8 EncryptionKeyLength; __u16 ByteCount; union { diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index d322c7c6eba3c..7cb047b262645 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -183,6 +183,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) int rc = 0; int bytes_returned; struct TCP_Server_Info * server; + u16 count; if(ses->server) server = ses->server; @@ -199,12 +200,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) if (extended_security) pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; - pSMB->ByteCount = strlen(protocols[0].name) + 1; + count = strlen(protocols[0].name) + 1; strncpy(pSMB->DialectsArray, protocols[0].name, 30); /* null guaranteed to be at end of source and target buffers anyway */ - pSMB->hdr.smb_buf_length += pSMB->ByteCount; - pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); + pSMB->hdr.smb_buf_length += count; + pSMB->ByteCount = cpu_to_le16(count); rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); @@ -236,7 +237,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) && (server->capabilities & CAP_EXTENDED_SECURITY)) { - __u16 count = le16_to_cpu(pSMBr->ByteCount); + count = pSMBr->ByteCount; if (count < 16) rc = -EIO; else if (count == 16) { -- 2.53.0