mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RAS/AMD/FMPM: use struct_size_t
@ 2026-03-17  3:16 Rosen Penev
  2026-03-19 16:28 ` Yazen Ghannam
  0 siblings, 1 reply; 5+ messages in thread
From: Rosen Penev @ 2026-03-17  3:16 UTC (permalink / raw)
  To: linux-edac; +Cc: Yazen Ghannam, Tony Luck, Borislav Petkov, open list

Avoids manual size calculation with the proper helper.

Also use kzalloc_flex for the same reason.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/ras/amd/fmpm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 34ef75af31cb..af862fbb04a8 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -150,7 +150,7 @@ static unsigned int max_nr_fru;
 /* Total length of record including headers and list of descriptor entries. */
 static size_t max_rec_len;
 
-#define FMPM_MAX_REC_LEN (sizeof(struct fru_rec) + (sizeof(struct cper_fru_poison_desc) * 255))
+#define FMPM_MAX_REC_LEN struct_size_t(struct fru_rec, entries, 255)
 
 /* Total number of SPA entries across all FRUs. */
 static unsigned int spa_nr_entries;
@@ -794,8 +794,7 @@ static int get_system_info(void)
 
 	spa_nr_entries = max_nr_fru * max_nr_entries;
 
-	max_rec_len  = sizeof(struct fru_rec);
-	max_rec_len += sizeof(struct cper_fru_poison_desc) * max_nr_entries;
+	max_rec_len = struct_size_t(struct fru_rec, entries, max_nr_entries);
 
 	pr_info("max FRUs: %u, max entries: %u, max record length: %lu\n",
 		 max_nr_fru, max_nr_entries, max_rec_len);
@@ -826,7 +825,7 @@ static int allocate_records(void)
 	}
 
 	for (i = 0; i < max_nr_fru; i++) {
-		fru_records[i] = kzalloc(max_rec_len, GFP_KERNEL);
+		fru_records[i] = kzalloc_flex(*fru_records[i], entries, max_nr_entries);
 		if (!fru_records[i]) {
 			ret = -ENOMEM;
 			goto out_free;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RAS/AMD/FMPM: use struct_size_t
  2026-03-17  3:16 [PATCH] RAS/AMD/FMPM: use struct_size_t Rosen Penev
@ 2026-03-19 16:28 ` Yazen Ghannam
  2026-09-19  3:54   ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Yazen Ghannam @ 2026-03-19 16:28 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-edac, Tony Luck, Borislav Petkov, open list

On Mon, Mar 16, 2026 at 08:16:50PM -0700, Rosen Penev wrote:
> Avoids manual size calculation with the proper helper.
> 
> Also use kzalloc_flex for the same reason.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>

Thanks,
Yazen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RAS/AMD/FMPM: use struct_size_t
  2026-03-19 16:28 ` Yazen Ghannam
@ 2026-09-19  3:54   ` Borislav Petkov
  2026-09-21 15:36     ` Yazen Ghannam
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2026-09-19  3:54 UTC (permalink / raw)
  To: Yazen Ghannam; +Cc: Rosen Penev, linux-edac, Tony Luck, open list

On Thu, Mar 19, 2026 at 12:28:18PM -0400, Yazen Ghannam wrote:
> On Mon, Mar 16, 2026 at 08:16:50PM -0700, Rosen Penev wrote:
> > Avoids manual size calculation with the proper helper.
> > 
> > Also use kzalloc_flex for the same reason.
> > 
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> 
> Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>

https://sashiko.dev/#/patchset/20260317031650.93712-1-rosenp%40gmail.com

Yazen, there are funnies for you too in there.

:-)

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RAS/AMD/FMPM: use struct_size_t
  2026-09-19  3:54   ` Borislav Petkov
@ 2026-09-21 15:36     ` Yazen Ghannam
  2026-09-21 17:52       ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Yazen Ghannam @ 2026-09-21 15:36 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Rosen Penev, linux-edac, Tony Luck, open list

On Fri, Sep 18, 2026 at 08:54:57PM -0700, Borislav Petkov wrote:
> On Thu, Mar 19, 2026 at 12:28:18PM -0400, Yazen Ghannam wrote:
> > On Mon, Mar 16, 2026 at 08:16:50PM -0700, Rosen Penev wrote:
> > > Avoids manual size calculation with the proper helper.
> > > 
> > > Also use kzalloc_flex for the same reason.
> > > 
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > 
> > Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
> 
> https://sashiko.dev/#/patchset/20260317031650.93712-1-rosenp%40gmail.com
> 
> Yazen, there are funnies for you too in there.
> 
> :-)
> 

As always :P.

BTW, how are you triggering Sashiko?

I see that Sashiko replies directly on the linux-pci list.
Ex. https://lore.kernel.org/all/20260918145619.3016889-1-yazen.ghannam@amd.com/

It's nice to have the email replies rather than just the web interface.

Thanks,
Yazen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RAS/AMD/FMPM: use struct_size_t
  2026-09-21 15:36     ` Yazen Ghannam
@ 2026-09-21 17:52       ` Borislav Petkov
  0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2026-09-21 17:52 UTC (permalink / raw)
  To: Yazen Ghannam; +Cc: Rosen Penev, linux-edac, Tony Luck, open list

On Mon, Sep 21, 2026 at 11:36:40AM -0400, Yazen Ghannam wrote:
> BTW, how are you triggering Sashiko?

I don't. It reviews everything that lands on LKML.

> I see that Sashiko replies directly on the linux-pci list.
> Ex. https://lore.kernel.org/all/20260918145619.3016889-1-yazen.ghannam@amd.com/
> 
> It's nice to have the email replies rather than just the web interface.

I think that can be configured on a per subsystem basis but I'm not sure.

There were some threads flying by on the subject.

You can always simply search the web interface for reviews. It is pretty quick
with the review, usually.

HTH.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-21 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-17  3:16 [PATCH] RAS/AMD/FMPM: use struct_size_t Rosen Penev
2026-03-19 16:28 ` Yazen Ghannam
2026-09-19  3:54   ` Borislav Petkov
2026-09-21 15:36     ` Yazen Ghannam
2026-09-21 17:52       ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®