Linux-Next discussions
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: dan.j.williams@intel.com
Cc: Cedric Xing <cedric.xing@intel.com>,
	sfr@canb.auug.org.au,
	 sathyanarayanan.kuppuswamy@linux.intel.com, yilun.xu@intel.com,
	sameo@rivosinc.com, aik@amd.com,  suzuki.poulose@arm.com,
	steven.price@arm.com, lukas@wunner.de, greg@kroah.com,
	 linux-next@vger.kernel.org
Subject: Re: [PATCH v2] tsm-mr: Fix init breakage after bin_attrs constification by scoping non-const pointers to init phase
Date: Tue, 13 May 2025 20:25:48 +0200	[thread overview]
Message-ID: <3cb81201-b75c-46ac-ac64-9810356877c0@t-8ch.de> (raw)
In-Reply-To: <6823818a4ccba_49706100aa@dwillia2-mobl4.notmuch>

On 2025-05-13 10:29:46-0700, dan.j.williams@intel.com wrote:
> dan.j.williams@ wrote:
> > Thomas Weißschuh wrote:
> > > On 2025-05-13 11:41:54-0500, Cedric Xing wrote:
> > > > Commit 9bec944506fa ("sysfs: constify attribute_group::bin_attrs") enforced
> > > > the ro-after-init principle by making elements of bin_attrs_new pointing to
> > > > const.
> > > > 
> > > > To align with this change, introduce a temporary variable `bap` within the
> > > > initialization loop. This improves code clarity by explicitly marking the
> > > > initialization scope and eliminates the need for type casts when assigning
> > > > to bin_attrs_new.
> > > > 
> > > > Signed-off-by: Cedric Xing <cedric.xing@intel.com>
> > > > ---
> > > >  drivers/virt/coco/tsm-mr.c | 30 +++++++++++++++---------------
> > > >  1 file changed, 15 insertions(+), 15 deletions(-)
> > > 
> > > <snip>
> > > 
> > > > @@ -244,7 +244,7 @@ EXPORT_SYMBOL_GPL(tsm_mr_create_attribute_group);
> > > >  void tsm_mr_free_attribute_group(const struct attribute_group *attr_grp)
> > > >  {
> > > >  	if (!IS_ERR_OR_NULL(attr_grp)) {
> > > > -		kfree(attr_grp->bin_attrs);
> > > > +		kfree(attr_grp->bin_attrs_new);
> > > 
> > > This is good, but the assignment also needs to be done to .bin_attrs_new.
> > > That is the code I can find on LKML:
> > > https://lore.kernel.org/lkml/20250506-tdx-rtmr-v6-1-ac6ff5e9d58a@intel.com/
> > 
> > Oh, the latest fixup that preceded this only went to linux-coco:
> > 
> > http://lore.kernel.org/20250509010104.669669-1-dan.j.williams@intel.com
> 
> Sorry, this one:
> 
> http://lore.kernel.org/20250509020739.882913-1-dan.j.williams@intel.com

Thanks for the pointer!

For this patch:

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>

  reply	other threads:[~2025-05-13 18:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 15:47 [PATCH] tsm-mr: Fix init breakage after bin_attrs constification by scoping non-const pointers to init phase Cedric Xing
2025-05-13 16:24 ` Thomas Weißschuh
2025-05-13 16:41   ` [PATCH v2] " Cedric Xing
2025-05-13 16:49     ` Thomas Weißschuh
2025-05-13 17:27       ` dan.j.williams
2025-05-13 17:29         ` dan.j.williams
2025-05-13 18:25           ` Thomas Weißschuh [this message]
2025-05-13 18:37     ` Dan Williams

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=3cb81201-b75c-46ac-ac64-9810356877c0@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=aik@amd.com \
    --cc=cedric.xing@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=greg@kroah.com \
    --cc=linux-next@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=sameo@rivosinc.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sfr@canb.auug.org.au \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yilun.xu@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