lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240214110541.GFZcyehY44eSSYsW2l@fat_crate.local>
Date: Wed, 14 Feb 2024 12:05:41 +0100
From: Borislav Petkov <bp@...en8.de>
To: Yazen Ghannam <yazen.ghannam@....com>
Cc: tony.luck@...el.com, linux-edac@...r.kernel.org,
	linux-kernel@...r.kernel.org, avadhut.naik@....com,
	john.allen@....com, muralidhara.mk@....com,
	naveenkrishna.chatradhi@....com, sathyapriya.k@....com
Subject: Re: [PATCH 2/2] RAS: Introduce the FRU Memory Poison Manager

On Tue, Feb 13, 2024 at 09:35:16PM -0600, Yazen Ghannam wrote:
> +static inline struct cper_fru_poison_desc *get_fpd(struct fru_rec *rec, u32 entry)
> +{
> +	return &rec->entries[entry];
> +}

This one needs to go too.

> +static inline u32 get_fmp_len(struct fru_rec *rec)
> +{
> +	return rec->sec_desc.section_length - sizeof(struct cper_section_descriptor);
> +}

Oh well, I guess we can keep that one.

> +/* Calculate a new checksum. */
> +static u32 get_fmp_checksum(struct fru_rec *rec)
> +{
> +	struct cper_sec_fru_mem_poison *fmp = get_fmp(rec);
> +	u32 len, checksum;
> +
> +	len = get_fmp_len(rec);
> +
> +	/* Get the current total. */
> +	checksum = do_fmp_checksum(fmp, len);
> +
> +	/* Subtract the current checksum from total. */
> +	checksum -= fmp->checksum;
> +
> +	/* Return the compliment value. */
> +	return 0 - checksum;
> +}

Let's get rid of that one.

Also, I think it is called *complement* value and you simply do

        /* Use the complement value. */
        rec->fmp.checksum = -checksum;

I'd say.

---

diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 9eaf892e35b9..f8799beddcc4 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -195,11 +195,12 @@ static u32 do_fmp_checksum(struct cper_sec_fru_mem_poison *fmp, u32 len)
 	return checksum;
 }
 
-/* Calculate a new checksum. */
-static u32 get_fmp_checksum(struct fru_rec *rec)
+static int update_record_on_storage(struct fru_rec *rec)
 {
 	u32 len, checksum;
+	int ret;
 
+	/* Calculate a new checksum. */
 	len = get_fmp_len(rec);
 
 	/* Get the current total. */
@@ -208,15 +209,8 @@ static u32 get_fmp_checksum(struct fru_rec *rec)
 	/* Subtract the current checksum from total. */
 	checksum -= rec->fmp.checksum;
 
-	/* Return the compliment value. */
-	return 0 - checksum;
-}
-
-static int update_record_on_storage(struct fru_rec *rec)
-{
-	int ret;
-
-	rec->fmp.checksum = get_fmp_checksum(rec);
+	/* Use the complement value. */
+	rec->fmp.checksum = -checksum;
 
 	pr_debug("Writing to storage");
 

-- 
Regards/Gruss,
    Boris.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ