Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: CIFS <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH][next] smb: client: Fix struct_group() usage in __packed structs
Date: Wed, 24 Apr 2024 01:08:07 -0500	[thread overview]
Message-ID: <CAH2r5mt3W9Y8MJkUyVGjj9-Z_tVJS1UsuV3=1BnA=pch7+MzPg@mail.gmail.com> (raw)
In-Reply-To: <CAKYAXd-i3Fjv-7JmQa8bSrWD69yFfi8jqfBJV51JgyseA-yXFQ@mail.gmail.com>

Added to cifs-2.6.git for-next

On Tue, Apr 23, 2024 at 11:36 PM Namjae Jeon <linkinjeon@kernel.org> wrote:
>
> 2024년 4월 24일 (수) 오전 11:41, Gustavo A. R. Silva <gustavoars@kernel.org>님이 작성:
> >
> > Use struct_group_attr() in __packed structs, instead of struct_group().
> >
> > Below you can see the pahole output before/after changes:
> >
> > pahole -C smb2_file_network_open_info fs/smb/client/smb2ops.o
> > struct smb2_file_network_open_info {
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le64     AllocationSize;       /*    32     8 */
> >                         __le64     EndOfFile;            /*    40     8 */
> >                         __le32     Attributes;           /*    48     4 */
> >                 };                                       /*     0    56 */
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le64     AllocationSize;       /*    32     8 */
> >                         __le64     EndOfFile;            /*    40     8 */
> >                         __le32     Attributes;           /*    48     4 */
> >                 } network_open_info;                     /*     0    56 */
> >         };                                               /*     0    56 */
> >         __le32                     Reserved;             /*    56     4 */
> >
> >         /* size: 60, cachelines: 1, members: 2 */
> >         /* last cacheline: 60 bytes */
> > } __attribute__((__packed__));
> >
> > pahole -C smb2_file_network_open_info fs/smb/client/smb2ops.o
> > struct smb2_file_network_open_info {
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le64     AllocationSize;       /*    32     8 */
> >                         __le64     EndOfFile;            /*    40     8 */
> >                         __le32     Attributes;           /*    48     4 */
> >                 } __attribute__((__packed__));           /*     0    52 */
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le64     AllocationSize;       /*    32     8 */
> >                         __le64     EndOfFile;            /*    40     8 */
> >                         __le32     Attributes;           /*    48     4 */
> >                 } __attribute__((__packed__)) network_open_info;       /*     0    52 */
> >         };                                               /*     0    52 */
> >         __le32                     Reserved;             /*    52     4 */
> >
> >         /* size: 56, cachelines: 1, members: 2 */
> >         /* last cacheline: 56 bytes */
> > };
> >
> > pahole -C smb_com_open_rsp fs/smb/client/cifssmb.o
> > struct smb_com_open_rsp {
> >         ...
> >
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*    48     8 */
> >                         __le64     LastAccessTime;       /*    56     8 */
> >                         /* --- cacheline 1 boundary (64 bytes) --- */
> >                         __le64     LastWriteTime;        /*    64     8 */
> >                         __le64     ChangeTime;           /*    72     8 */
> >                         __le32     FileAttributes;       /*    80     4 */
> >                 };                                       /*    48    40 */
> >                 struct {
> >                         __le64     CreationTime;         /*    48     8 */
> >                         __le64     LastAccessTime;       /*    56     8 */
> >                         /* --- cacheline 1 boundary (64 bytes) --- */
> >                         __le64     LastWriteTime;        /*    64     8 */
> >                         __le64     ChangeTime;           /*    72     8 */
> >                         __le32     FileAttributes;       /*    80     4 */
> >                 } common_attributes;                     /*    48    40 */
> >         };                                               /*    48    40 */
> >
> >         ...
> >
> >         /* size: 111, cachelines: 2, members: 14 */
> >         /* last cacheline: 47 bytes */
> > } __attribute__((__packed__));
> >
> > pahole -C smb_com_open_rsp fs/smb/client/cifssmb.o
> > struct smb_com_open_rsp {
> >         ...
> >
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*    48     8 */
> >                         __le64     LastAccessTime;       /*    56     8 */
> >                         /* --- cacheline 1 boundary (64 bytes) --- */
> >                         __le64     LastWriteTime;        /*    64     8 */
> >                         __le64     ChangeTime;           /*    72     8 */
> >                         __le32     FileAttributes;       /*    80     4 */
> >                 } __attribute__((__packed__));           /*    48    36 */
> >                 struct {
> >                         __le64     CreationTime;         /*    48     8 */
> >                         __le64     LastAccessTime;       /*    56     8 */
> >                         /* --- cacheline 1 boundary (64 bytes) --- */
> >                         __le64     LastWriteTime;        /*    64     8 */
> >                         __le64     ChangeTime;           /*    72     8 */
> >                         __le32     FileAttributes;       /*    80     4 */
> >                 } __attribute__((__packed__)) common_attributes;       /*    48    36 */
> >         };                                               /*    48    36 */
> >
> >         ...
> >
> >         /* size: 107, cachelines: 2, members: 14 */
> >         /* last cacheline: 43 bytes */
> > } __attribute__((__packed__));
> >
> > pahole -C FILE_ALL_INFO fs/smb/client/cifssmb.o
> > typedef struct {
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le32     Attributes;           /*    32     4 */
> >                 };                                       /*     0    40 */
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le32     Attributes;           /*    32     4 */
> >                 } common_attributes;                     /*     0    40 */
> >         };                                               /*     0    40 */
> >
> >         ...
> >
> >         /* size: 113, cachelines: 2, members: 17 */
> >         /* last cacheline: 49 bytes */
> > } __attribute__((__packed__)) FILE_ALL_INFO;
> >
> > pahole -C FILE_ALL_INFO fs/smb/client/cifssmb.o
> > typedef struct {
> >         union {
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le32     Attributes;           /*    32     4 */
> >                 } __attribute__((__packed__));           /*     0    36 */
> >                 struct {
> >                         __le64     CreationTime;         /*     0     8 */
> >                         __le64     LastAccessTime;       /*     8     8 */
> >                         __le64     LastWriteTime;        /*    16     8 */
> >                         __le64     ChangeTime;           /*    24     8 */
> >                         __le32     Attributes;           /*    32     4 */
> >                 } __attribute__((__packed__)) common_attributes;       /*     0    36 */
> >         };                                               /*     0    36 */
> >
> >         ...
> >
> >         /* size: 109, cachelines: 2, members: 17 */
> >         /* last
>
> cacheline: 45 bytes */
> > } __attribute__((__packed__)) FILE_ALL_INFO;
> >
> > Fixes: 0015eb6e1238 ("smb: client, common: fix fortify warnings")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> Looks good to me:)
> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
> Thanks!
>


-- 
Thanks,

Steve

      reply	other threads:[~2024-04-24  6:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  2:41 [PATCH][next] smb: client: Fix struct_group() usage in __packed structs Gustavo A. R. Silva
2024-04-24  4:36 ` Namjae Jeon
2024-04-24  6:08   ` Steve French [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='CAH2r5mt3W9Y8MJkUyVGjj9-Z_tVJS1UsuV3=1BnA=pch7+MzPg@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=gustavoars@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).