提交 321ece4d 编写于 作者: M Mauro Carvalho Chehab

i7core_edac: Fix ringbuffer maxsize

Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 6e103be1
...@@ -1631,14 +1631,14 @@ static void i7core_check_error(struct mem_ctl_info *mci) ...@@ -1631,14 +1631,14 @@ static void i7core_check_error(struct mem_ctl_info *mci)
* loosing an error. * loosing an error.
*/ */
smp_rmb(); smp_rmb();
count = (pvt->mce_out + sizeof(mce_entry) - pvt->mce_in) count = (pvt->mce_out + MCE_LOG_LEN - pvt->mce_in)
% sizeof(mce_entry); % MCE_LOG_LEN;
if (!count) if (!count)
return; return;
m = pvt->mce_outentry; m = pvt->mce_outentry;
if (pvt->mce_in + count > sizeof(mce_entry)) { if (pvt->mce_in + count > MCE_LOG_LEN) {
unsigned l = sizeof(mce_entry) - pvt->mce_in; unsigned l = MCE_LOG_LEN - pvt->mce_in;
memcpy(m, &pvt->mce_entry[pvt->mce_in], sizeof(*m) * l); memcpy(m, &pvt->mce_entry[pvt->mce_in], sizeof(*m) * l);
smp_wmb(); smp_wmb();
...@@ -1702,7 +1702,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce) ...@@ -1702,7 +1702,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
return 0; return 0;
smp_rmb(); smp_rmb();
if ((pvt->mce_out + 1) % sizeof(mce_entry) == pvt->mce_in) { if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) {
smp_wmb(); smp_wmb();
pvt->mce_overrun++; pvt->mce_overrun++;
return 0; return 0;
...@@ -1711,7 +1711,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce) ...@@ -1711,7 +1711,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
/* Copy memory error at the ringbuffer */ /* Copy memory error at the ringbuffer */
memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce)); memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce));
smp_wmb(); smp_wmb();
pvt->mce_out = (pvt->mce_out + 1) % sizeof(mce_entry); pvt->mce_out = (pvt->mce_out + 1) % MCE_LOG_LEN;
/* Handle fatal errors immediately */ /* Handle fatal errors immediately */
if (mce->mcgstatus & 1) if (mce->mcgstatus & 1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册