public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	rui.zhang@intel.com, lukasz.luba@arm.com, gustavoars@kernel.org,
	morbo@google.com, justinstitt@google.com,
	stanislaw.gruszka@linux.intel.com, linux-pm@vger.kernel.org,
	linux-hardening@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev
Subject: Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()
Date: Tue, 27 Feb 2024 09:00:44 -0800	[thread overview]
Message-ID: <202402270852.E46A5268@keescook> (raw)
In-Reply-To: <bbc65508-eb0e-4d63-921b-85d242cc556f@linaro.org>

On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote:
> Ok my misunderstanding was I thought sizeof() was calling _bdos under the
> hood, so when calling sizeof(flex_array), it was returning the computed size
> inferring from the __counted_by field.

Yeah, sizeof() has a very limited scope. __builtin_object_size() has
more flexibility (via the 2nd argument, "type"), but it was still
compile-time only. __builtin_dynamic_object_size() was added to bring
runtime evaluations into the mix (initially to support the alloc_size
attribute, and now includes the counted_by attribute too).

-- 
Kees Cook

  reply	other threads:[~2024-02-27 17:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  0:54 [PATCH] thermal: core: Move initial num_trips assignment before memcpy() Nathan Chancellor
2024-02-27  2:08 ` Kees Cook
2024-02-27 11:07   ` Rafael J. Wysocki
2024-02-27  9:58 ` Lukasz Luba
2024-02-27 10:14 ` Daniel Lezcano
2024-02-27 11:09   ` Rafael J. Wysocki
2024-02-27 15:37     ` Daniel Lezcano
2024-02-27 16:26       ` Kees Cook
2024-02-27 16:47         ` Daniel Lezcano
2024-02-27 17:00           ` Kees Cook [this message]
2024-02-28  8:41             ` Lukasz Luba
2024-02-28 16:56               ` Nathan Chancellor
2024-02-28 17:48                 ` Kees Cook
2024-02-29  7:42                   ` Lukasz Luba
2024-02-27 16:26       ` Nathan Chancellor

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=202402270852.E46A5268@keescook \
    --to=keescook@chromium.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=gustavoars@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=lukasz.luba@arm.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=stanislaw.gruszka@linux.intel.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