[Nouveau] [PATCH envytools] nvbios: Truncate nb of entries to avoid displaying garbage
Christian Costa
titan.costa at gmail.com
Sat Aug 30 10:05:17 PDT 2014
We return an error but this does not prevent the display so just make sure only valid data are printed.
---
nvbios/mem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/nvbios/mem.c b/nvbios/mem.c
index e4797e3..00f5cd5 100644
--- a/nvbios/mem.c
+++ b/nvbios/mem.c
@@ -112,6 +112,7 @@ envy_bios_parse_mem_train (struct envy_bios *bios) {
entry->offset = mt->offset + mt->hlen + ((mt->rlen + mt->subentries * mt->subentrylen) * i);
err |= bios_u8(bios, entry->offset, &entry->u00);
if (mt->subentries > sizeof(entry->subentry)) {
+ mt->subentries = sizeof(entry->subentry);
ENVY_BIOS_ERR("Error when parsing mem train: subentries = %d > %lu\n", mt->subentries, sizeof(entry->subentry));
return -EFAULT;
}
--
1.9.1
More information about the Nouveau
mailing list