On Wed, 2017-07-26 at 10:48 +0200, Borislav Petkov wrote:
> From: Borislav Petkov <b...@suse.de>
> 
> Register with the GHES notifier chain so that there's no need to call
> into the module with ghes_edac_report_mem_error().
> 
> Signed-off-by: Borislav Petkov <b...@suse.de>
 :
> +static int report_mem_error(struct notifier_block *nb, unsigned long
> sev, void *data)
>  {
> +     struct cper_sec_mem_err *mem_err = data;
>       enum hw_event_mc_err_type type;
>       struct edac_raw_error_desc *e;
>       struct mem_ctl_info *mci;
> -     struct ghes_edac_pvt *pvt = NULL;
> -     char *p;
> +     struct ghes_edac_pvt *pvt = ghes_pvt;
>       u8 grain_bits;
> +     char *p;
>  
> -     list_for_each_entry(pvt, &ghes_reglist, list) {
> -             if (ghes == pvt->ghes)
> -                     break;
> -     }
>       if (!pvt) {

I think it always hits this error condition.  See below.

> -             pr_err("Internal error: Can't find EDAC
> structure\n");
> -             return;
> +             edac_pr_err("Internal error: Can't find EDAC
> structure\n");
> +             return NOTIFY_DONE;
>       }
> +
 :
> +static int __init ghes_edac_register(void)
>  {
> +     struct ghes_edac_pvt *pvt = ghes_pvt;

This simply sets NULL to pvt, and does not initialize ghes_pvt.

>       bool fake = false;
>       int rc, num_dimm = 0;
>       struct mem_ctl_info *mci;
>       struct edac_mc_layer layers[1];
> -     struct ghes_edac_pvt *pvt;
>       struct ghes_edac_dimm_fill dimm_fill;
>  
 :
> -EXPORT_SYMBOL_GPL(ghes_edac_register);
> +module_init(ghes_edac_register);

Since this patch has removed the GHES-presence check and ordering hack
for ghes_edac, it now registers itself per the module_init() ordering
regardless of the presence of GHES.  As Mauro pointed out, some type of
GHES check needs to be in place before making this change.

Thanks,
-Toshi

Reply via email to