public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Alejandro Colomar <alx@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-hardening@vger.kernel.org
Subject: Re: struct_size() using sizeof() vs offsetof()
Date: Thu, 17 Aug 2023 10:05:52 -0600	[thread overview]
Message-ID: <f12c6f14-66c4-6afb-e768-fa7abcfd1bbc@embeddedor.com> (raw)
In-Reply-To: <09b4a2ce-da74-3a19-6961-67883f634d98@kernel.org>


> -               tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL);
> +               tp_c = kzalloc(struct_size(tp_c, hlist->ht, 1), GFP_KERNEL);

I just sent a fix[1].

Thanks for reporting this! :)
--
Gustavo

[1] https://lore.kernel.org/linux-hardening/ZN5DvRyq6JNz20l1@work/

  reply	other threads:[~2023-08-17 16:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  0:23 struct_size() using sizeof() vs offsetof() Alejandro Colomar
2023-08-17  3:05 ` Kees Cook
2023-08-17 12:39   ` Alejandro Colomar
2023-08-17 16:05     ` Gustavo A. R. Silva [this message]
2023-08-17 18:37       ` Alejandro Colomar
2023-08-21  8:38         ` David Laight
2023-08-21 13:51           ` Alejandro Colomar
2023-08-21  8:16 ` David Laight
2023-08-21 13:45   ` Alejandro Colomar

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=f12c6f14-66c4-6afb-e768-fa7abcfd1bbc@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=alx@kernel.org \
    --cc=gustavoars@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@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