[PATCH v3 12/13] smb: client: Use hmac_sha256_zeroize_ctx function to clear hmac_sha256_ctx
From: Thomas Huth
Date: Thu Sep 10 2026 - 08:53:30 EST
It's just cosmetics, but now that we have a helper function for clearing
hmac_sha256_ctx with a __cleanup() statement, we can also use it in the smb
client code for good measure.
Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
fs/smb/client/smb2transport.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index c407f30e00401..080864b24a0c5 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -212,7 +212,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
unsigned char smb2_signature[SMB2_HMACSHA256_SIZE];
struct kvec *iov = rqst->rq_iov;
struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0].iov_base;
- struct hmac_sha256_ctx hmac_ctx;
+ struct hmac_sha256_ctx hmac_ctx __cleanup(hmac_sha256_zeroize_ctx);
struct smb_rqst drqst;
__u64 sid = le64_to_cpu(shdr->SessionId);
u8 key[SMB2_NTLMV2_SESSKEY_SIZE];
@@ -250,7 +250,6 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
memcpy(shdr->Signature, smb2_signature, SMB2_SIGNATURE_SIZE);
memzero_explicit(key, sizeof(key));
- memzero_explicit(&hmac_ctx, sizeof(hmac_ctx));
return rc;
}
--
2.55.0