From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-hardening@vger.kernel.org
Subject: 2-member sized buffer structs struct_size()
Date: Tue, 10 Oct 2023 16:18:56 -0700 [thread overview]
Message-ID: <202310101614.AA6B7C4@keescook> (raw)
In-Reply-To: <202310101552.3578F46@keescook>
On Tue, Oct 10, 2023 at 03:53:28PM -0700, Kees Cook wrote:
> It's surprising how many of these 2-member structs we have in the kernel
> that do the same basic thing. :)
75. We have 75 of them:
// Options: --all-includes
@sized_byte_buffer@
identifier NAME, SIZE, ARRAY;
typedef s8, s16, s32, s64;
typedef __s8, __s16, __s32, __s64;
typedef u8, u16, u32, u64;
typedef __u8, __u16, __u32, __u64;
type SIZE_TYPE = {char, short, int, long, long long, ssize_t,
s8, s16, s32, s64, __s8, __s16, __s32, __s64,
unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, size_t,
u8, u16, u32, u64, __u8, __u16, __u32, __u64};
type BYTE_TYPE = {char, unsigned char, u8, __u8};
@@
*struct NAME {
SIZE_TYPE SIZE;
BYTE_TYPE ARRAY[];
};
https://paste.ubuntu.com/p/39CyK9nyqX/
Agh
--
Kees Cook
next prev parent reply other threads:[~2023-10-10 23:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 12:59 [PATCH][next] afs: Add __counted_by for struct afs_acl and use struct_size() Gustavo A. R. Silva
2023-10-10 22:53 ` Kees Cook
2023-10-10 23:18 ` Kees Cook [this message]
2023-11-30 22:00 ` Kees Cook
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=202310101614.AA6B7C4@keescook \
--to=keescook@chromium.org \
--cc=gustavoars@kernel.org \
--cc=linux-hardening@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.