Skip to contentSkip to conversation

endianness bitrot in cifs

PATCH In review Al Viro 2 participants 2 messages Aug 15, 2006

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 endianness bitrot in cifs

le16 compared to host-endian constant
u8 fed to le32_to_cpu()
le16 compared to host-endian constant

----

fs/cifs/cifssmb.c +1 -1
index 19678c5..6a76ae5 100644
@@ -477,7 +477,7 @@ #ifdef CONFIG_CIFS_WEAK_PW_HASH 
 		/* BB get server time for time conversions and add
 		code to use it and timezone since this is not UTC */	
 
-		if (rsp->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) {
+		if (rsp->EncryptionKeyLength == cpu_to_le16(CIFS_CRYPTO_KEY_SIZE)) {
 			memcpy(server->cryptKey, rsp->EncryptionKey,
 				CIFS_CRYPTO_KEY_SIZE);
 		} else if (server->secMode & SECMODE_PW_ENCRYPT) {
fs/cifs/readdir.c +1 -1
index 03bbcb3..105761e 100644
@@ -556,7 +556,7 @@ static int cifs_entry_is_dot(char *curre
 		FIND_FILE_STANDARD_INFO * pFindData =
 			(FIND_FILE_STANDARD_INFO *)current_entry;
 		filename = &pFindData->FileName[0];
-		len = le32_to_cpu(pFindData->FileNameLength);
+		len = pFindData->FileNameLength;
 	} else {
 		cFYI(1,("Unknown findfirst level %d",cfile->srch_inf.info_level));
 	}
fs/cifs/sess.c +1 -1
index 7202d53..d1705ab 100644
@@ -372,7 +372,7 @@ #ifdef CONFIG_CIFS_WEAK_PW_HASH
 
 		/* no capabilities flags in old lanman negotiation */
 
-		pSMB->old_req.PasswordLength = CIFS_SESS_KEY_SIZE; 
+		pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_SESS_KEY_SIZE); 
 		/* BB calculate hash with password */
 		/* and copy into bcc */
 
#1 lore raw
Quoted 4 lines · Al Viro

le16 compared to host-endian constant
u8 fed to le32_to_cpu()
le16 compared to host-endian constant

Thanks - I have applied this to the cifs git tree so should be in mm soon.
Fortunately this only hit the relatively new lanman support (e.g. Win9x and OS/2 server support not as common anymore - but was needed before smbfs deprecation).