Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb: use macros instead of constants for leasekey size and default cifsattrs value
@ 2024-12-16 18:39 Bharath SM
  2024-12-16 20:42 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Bharath SM @ 2024-12-16 18:39 UTC (permalink / raw)
  To: linux-cifs, sfrench, pc, sprasad; +Cc: Bharath SM

Replace default hardcoded value for cifsAttrs with ATTR_ARCHIVE macro
Use SMB2_LEASE_KEY_SIZE macro for leasekey size in smb2_lease_break

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
 fs/smb/client/cifsfs.c  | 2 +-
 fs/smb/client/smb2pdu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index c9f9b6e97964..722be656f5dc 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -398,7 +398,7 @@ cifs_alloc_inode(struct super_block *sb)
 	cifs_inode = alloc_inode_sb(sb, cifs_inode_cachep, GFP_KERNEL);
 	if (!cifs_inode)
 		return NULL;
-	cifs_inode->cifsAttrs = 0x20;	/* default */
+	cifs_inode->cifsAttrs = ATTR_ARCHIVE;	/* default */
 	cifs_inode->time = 0;
 	/*
 	 * Until the file is open and we have gotten oplock info back from the
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 010eae9d6c47..c945b94318f8 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -6204,7 +6204,7 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
 	req->StructureSize = cpu_to_le16(36);
 	total_len += 12;
 
-	memcpy(req->LeaseKey, lease_key, 16);
+	memcpy(req->LeaseKey, lease_key, SMB2_LEASE_KEY_SIZE);
 	req->LeaseState = lease_state;
 
 	flags |= CIFS_NO_RSP_BUF;
-- 
2.43.0


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

* Re: [PATCH] smb: use macros instead of constants for leasekey size and default cifsattrs value
  2024-12-16 18:39 [PATCH] smb: use macros instead of constants for leasekey size and default cifsattrs value Bharath SM
@ 2024-12-16 20:42 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2024-12-16 20:42 UTC (permalink / raw)
  To: Bharath SM; +Cc: linux-cifs, sfrench, pc, sprasad, Bharath SM

merged into cifs-2.6.git for-next

On Mon, Dec 16, 2024 at 12:39 PM Bharath SM <bharathsm.hsk@gmail.com> wrote:
>
> Replace default hardcoded value for cifsAttrs with ATTR_ARCHIVE macro
> Use SMB2_LEASE_KEY_SIZE macro for leasekey size in smb2_lease_break
>
> Signed-off-by: Bharath SM <bharathsm@microsoft.com>
> ---
>  fs/smb/client/cifsfs.c  | 2 +-
>  fs/smb/client/smb2pdu.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
> index c9f9b6e97964..722be656f5dc 100644
> --- a/fs/smb/client/cifsfs.c
> +++ b/fs/smb/client/cifsfs.c
> @@ -398,7 +398,7 @@ cifs_alloc_inode(struct super_block *sb)
>         cifs_inode = alloc_inode_sb(sb, cifs_inode_cachep, GFP_KERNEL);
>         if (!cifs_inode)
>                 return NULL;
> -       cifs_inode->cifsAttrs = 0x20;   /* default */
> +       cifs_inode->cifsAttrs = ATTR_ARCHIVE;   /* default */
>         cifs_inode->time = 0;
>         /*
>          * Until the file is open and we have gotten oplock info back from the
> diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
> index 010eae9d6c47..c945b94318f8 100644
> --- a/fs/smb/client/smb2pdu.c
> +++ b/fs/smb/client/smb2pdu.c
> @@ -6204,7 +6204,7 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
>         req->StructureSize = cpu_to_le16(36);
>         total_len += 12;
>
> -       memcpy(req->LeaseKey, lease_key, 16);
> +       memcpy(req->LeaseKey, lease_key, SMB2_LEASE_KEY_SIZE);
>         req->LeaseState = lease_state;
>
>         flags |= CIFS_NO_RSP_BUF;
> --
> 2.43.0
>
>


-- 
Thanks,

Steve

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

end of thread, other threads:[~2024-12-16 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 18:39 [PATCH] smb: use macros instead of constants for leasekey size and default cifsattrs value Bharath SM
2024-12-16 20:42 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox