Re: [PATCH 3/3] EDAC, ghes: Make it a proper module

From: Borislav Petkov
Date: Sat Jul 29 2017 - 02:47:57 EST


On Fri, Jul 28, 2017 at 06:50:56PM +0000, Kani, Toshimitsu wrote:
> This simply sets NULL to pvt, and does not initialize ghes_pvt.

Yeah, I guess we need this ontop:

---
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index ecd34b8bd27e..e158bf4ee337 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -422,7 +422,6 @@ static const char * const super_crap_msg =

static int __init ghes_edac_register(void)
{
- struct ghes_edac_pvt *pvt = ghes_pvt;
bool fake = false;
int rc, num_dimm = 0;
struct mem_ctl_info *mci;
@@ -446,15 +445,15 @@ static int __init ghes_edac_register(void)
* We need to serialize edac_mc_alloc() and edac_mc_add_mc(),
* to avoid duplicated memory controller numbers
*/
- mci = edac_mc_alloc(1, ARRAY_SIZE(layers), layers, sizeof(*pvt));
+ mci = edac_mc_alloc(1, ARRAY_SIZE(layers), layers, sizeof(struct ghes_edac_pvt));
if (!mci) {
edac_pr_err("Can't allocate memory for EDAC data\n");
return -ENOMEM;
}

- pvt = mci->pvt_info;
- memset(pvt, 0, sizeof(*pvt));
- pvt->mci = mci;
+ ghes_pvt = mci->pvt_info;
+ memset(ghes_pvt, 0, sizeof(struct ghes_edac_pvt));
+ ghes_pvt->mci = mci;

mci->pdev = &dummy_dev;

---

> As Mauro pointed out, some type of GHES check needs to be in place
> before making this change.

Your whitelist I guess.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--