Skip to contentSkip to conversation

CIFS: add int cast to silence warning

PATCH In review Aurelien Aptel 2 participants 2 messages Jun 26, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: add int cast to silence warning

The '*' field specifier expects an int and sizeof returns an unsigned long int but its always going to be a small positive value so casting is safe.

---
 fs/cifs/smb2transport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2transport.c +2 -1
index 437d11711b3e..ad0492c682e7 100644
@@ -349,7 +349,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
 	 * print it as a long long. we dump it as we got it on the
 	 * wire.
 	 */
-	cifs_dbg(VFS, "Session Id    %*ph\n", sizeof(ses->Suid), &ses->Suid);
+	cifs_dbg(VFS, "Session Id    %*ph\n", (int)sizeof(ses->Suid),
+		 &ses->Suid);
 	cifs_dbg(VFS, "Session Key   %*ph\n",
 		 SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response);
 	cifs_dbg(VFS, "Signing Key   %*ph\n",
Signature · 1 line
2.12.3

A message that is not in the archive (sent off-list or not yet received): 20170626124911.28449-1-aaptel-IBi9RG/[email protected]

#2 lore raw

I merged this with your previous patch into one and pushed to cifs-2.6.git for-next

Quoted 26 lines · Aurelien Aptel

The '*' field specifier expects an int and sizeof returns an unsigned long int but its always going to be a small positive value so casting is safe.

---
 fs/cifs/smb2transport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2transport.c +2 -2
index 437d11711b3e..ad0492c682e7 100644
@@ -349,7 +349,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
         * print it as a long long. we dump it as we got it on the
         * wire.
         */
-       cifs_dbg(VFS, "Session Id    %*ph\n", sizeof(ses->Suid), &ses->Suid);
+       cifs_dbg(VFS, "Session Id    %*ph\n", (int)sizeof(ses->Suid),
+                &ses->Suid);
        cifs_dbg(VFS, "Session Key   %*ph\n",
                 SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response);
        cifs_dbg(VFS, "Signing Key   %*ph\n",
--

2.12.3

Signature · 3 lines
Thanks,

Steve