The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: platform-driver-x86@vger.kernel.org,
	Hans de Goede <hansg@kernel.org>,  Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	 open list <linux-kernel@vger.kernel.org>,
	 "open list:KERNEL HARDENING" <linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] platform/x86/intel/tpmi/plr: allocate die_info with plr
Date: Mon, 11 May 2026 19:31:31 +0300 (EEST)	[thread overview]
Message-ID: <db8119fd-6d40-5df0-68ef-5579290c5bb9@linux.intel.com> (raw)
In-Reply-To: <20260430225309.117557-1-rosenp@gmail.com>

On Thu, 30 Apr 2026, Rosen Penev wrote:

> Simplifies allocations slightly.
> 
> Add __counted_by for extra runtime analysis.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/platform/x86/intel/plr_tpmi.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/plr_tpmi.c b/drivers/platform/x86/intel/plr_tpmi.c
> index 05727169f49c..2fd27e80bc1f 100644
> --- a/drivers/platform/x86/intel/plr_tpmi.c
> +++ b/drivers/platform/x86/intel/plr_tpmi.c
> @@ -57,9 +57,9 @@ struct tpmi_plr_die {
>  
>  struct tpmi_plr {
>  	struct dentry *dbgfs_dir;
> -	struct tpmi_plr_die *die_info;
>  	int num_dies;
>  	struct auxiliary_device *auxdev;
> +	struct tpmi_plr_die die_info[] __counted_by(num_dies);
>  };
>  
>  static const char * const plr_coarse_reasons[] = {
> @@ -278,15 +278,10 @@ static int intel_plr_probe(struct auxiliary_device *auxdev, const struct auxilia
>  	if (!num_resources)
>  		return -EINVAL;
>  
> -	plr = devm_kzalloc(&auxdev->dev, sizeof(*plr), GFP_KERNEL);
> +	plr = devm_kzalloc(&auxdev->dev, struct_size(plr, die_info, num_resources), GFP_KERNEL);

Is there some particular reason why we don't have devm_kzalloc_flex() 
other than that nobody has yet bothered to added one.

One of the most annoying thing with the various alloc APIs is that devm_* 
variants seem to never keep up with them. It would be nice if there would 
be some generic solution that when somebody decides a new alloc api func, 
the corresponding devm counterpart would be auto-generated for it.

-- 
 i.


       reply	other threads:[~2026-05-11 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260430225309.117557-1-rosenp@gmail.com>
2026-05-11 16:31 ` Ilpo Järvinen [this message]
2026-05-12  3:21   ` [PATCH] platform/x86/intel/tpmi/plr: allocate die_info with plr Rosen Penev

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=db8119fd-6d40-5df0-68ef-5579290c5bb9@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gustavoars@kernel.org \
    --cc=hansg@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rosenp@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