From: William Roche <william.ro...@oracle.com> The Corrected Error events collected by the cec_add_elem() have to be consistently filtered out. We fix the case where the value of find_elem() to find the slot of a pfn was mistakenly used as the return value of the function. Now the MCE notifiers chain relying on MCE_HANDLED_CEC would only report filtered corrected errors that reached the action threshold.
Signed-off-by: William Roche <william.ro...@oracle.com> --- Notes: This is the new patch version using an additional 'err' variable. Unit tested it on a VM instance and a "Bare Metal" machine. No reporting is done by the MCE_HANDLED_CEC aware notifiers until the action threshold is reached. drivers/ras/cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index ddecf25..b926c67 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -312,8 +312,8 @@ static bool sanity_check(struct ce_array *ca) static int cec_add_elem(u64 pfn) { struct ce_array *ca = &ce_arr; + int count, err, ret = 0; unsigned int to = 0; - int count, ret = 0; /* * We can be called very early on the identify_cpu() path where we are @@ -330,8 +330,8 @@ static int cec_add_elem(u64 pfn) if (ca->n == MAX_ELEMS) WARN_ON(!del_lru_elem_unlocked(ca)); - ret = find_elem(ca, pfn, &to); - if (ret < 0) { + err = find_elem(ca, pfn, &to); + if (err < 0) { /* * Shift range [to-end] to make room for one more element. */ -- 1.8.3.1