Skip to contentSkip to conversation

EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned

PATCH Applied Eric Badger 3 participants 4 messages Oct 3, 2021 – Oct 7, 2021 EDAC-core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned

This is cosmetically nicer for counts > INT32_MAX, and aligns the MC-scope format with that of the lower layer sysfs counter files.

---
 drivers/edac/edac_mc_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/edac/edac_mc_sysfs.c +4 -4
index 2f9f1e7..0a638c9 100644
@@ -744,7 +744,7 @@ static ssize_t mci_ue_count_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ue_mc);
+	return sprintf(data, "%u\n", mci->ue_mc);
 }
 
 static ssize_t mci_ce_count_show(struct device *dev,
@@ -753,7 +753,7 @@ static ssize_t mci_ce_count_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ce_mc);
+	return sprintf(data, "%u\n", mci->ce_mc);
 }
 
 static ssize_t mci_ce_noinfo_show(struct device *dev,
@@ -762,7 +762,7 @@ static ssize_t mci_ce_noinfo_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ce_noinfo_count);
+	return sprintf(data, "%u\n", mci->ce_noinfo_count);
 }
 
 static ssize_t mci_ue_noinfo_show(struct device *dev,
@@ -771,7 +771,7 @@ static ssize_t mci_ue_noinfo_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ue_noinfo_count);
+	return sprintf(data, "%u\n", mci->ue_noinfo_count);
 }
 
 static ssize_t mci_seconds_show(struct device *dev,
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines

This is cosmetically nicer for counts > INT32_MAX, and aligns the MC-scope format with that of the lower layer sysfs counter files.

While this is technically the right thing to do, I pity the system administrator that is looking at a system with more than 2147483647 corrected or uncorrected errors!

So:

but maybe this is just churn and not really useful in practice?

-Tony

#2 lore raw
Quoted 11 lines · Tony
Quoted 2 lines

This is cosmetically nicer for counts > INT32_MAX, and aligns the MC-scope format with that of the lower layer sysfs counter files.

While this is technically the right thing to do, I pity the system administrator that is looking at a system with more than 2147483647 corrected or uncorrected errors!

So:

but maybe this is just churn and not really useful in practice?

Pity accepted :). I only noticed the sign mismatch after seeing a negative value on a server in the wild. But it's cosmetic really; if you've reached INT32_MAX you'll probably reach UINT32_MAX and can't rely on the counter.

Cheers,
Eric

maintainer Applied
#3 lore raw
In reply to Eric Badger
Quoted 7 lines · Eric Badger

This is cosmetically nicer for counts > INT32_MAX, and aligns the MC-scope format with that of the lower layer sysfs counter files.

---
 drivers/edac/edac_mc_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

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