The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong.chenxiaosong@linux.dev>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: sfrench@samba.org, smfrench@gmail.com, linkinjeon@samba.org,
	christophe.jaillet@wanadoo.fr, linux-cifs@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenxiaosong@chenxiaosong.com
Subject: Re: [PATCH v8 1/1] smb: move FILE_SYSTEM_ATTRIBUTE_INFO to common/fscc.h
Date: Mon, 17 Nov 2025 09:06:15 +0800	[thread overview]
Message-ID: <d7a7ce57-f486-491e-9002-cc8cfc115521@linux.dev> (raw)
In-Reply-To: <CAKYAXd_ZcmQnxAD8iLMjnCvtTrqHvkgPcd_8QSRmfFn1avZ99g@mail.gmail.com>

Hi Namjae,

I have confirmed that when FileSystemName uses flexible array member, 
fsAttrInfo in struct cifs_tcon does not include FileSystemName.

The following part in the CIFSSMBQFSAttributeInfo() function is correct, 
we cannot add MAX_FS_NAME_LEN to sizeof(FILE_SYSTEM_ATTRIBUTE_INFO).

```c
CIFSSMBQFSAttributeInfo()
{
...
     memcpy(&tcon->fsAttrInfo, response_data,
         sizeof(FILE_SYSTEM_ATTRIBUTE_INFO)); // it's correct here
...
}
```

And in the following part of the SMB2_QFS_attr() function, we should 
change it to `memcpy(..., min_t(..., min_len))`.

```c
SMB2_QFS_attr()
{
...
     if (level == FS_ATTRIBUTE_INFORMATION)
             memcpy(&tcon->fsAttrInfo, offset
                     + (char *)rsp, min_t(unsigned int,
                     rsp_len, max_len)); // should use `min_len` here
...
}
```

Thanks,
ChenXiaoSong.

On 11/17/25 07:00, Namjae Jeon wrote:

> Did you check if it is being used here too?
> cifssmb.c:4866:        sizeof(FILE_SYSTEM_ATTRIBUTE_INFO));


      parent reply	other threads:[~2025-11-17  1:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-16  6:52 [PATCH v8 0/1] smb: move duplicate definitions to common header file chenxiaosong.chenxiaosong
2025-11-16  6:52 ` [PATCH v8 1/1] smb: move FILE_SYSTEM_ATTRIBUTE_INFO to common/fscc.h chenxiaosong.chenxiaosong
2025-11-16 23:00   ` Namjae Jeon
2025-11-16 23:47     ` ChenXiaoSong
2025-11-17  0:08       ` ChenXiaoSong
2025-11-17  1:04     ` ChenXiaoSong
2025-11-17  1:06     ` ChenXiaoSong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7a7ce57-f486-491e-9002-cc8cfc115521@linux.dev \
    --to=chenxiaosong.chenxiaosong@linux.dev \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linkinjeon@kernel.org \
    --cc=linkinjeon@samba.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox