From d3563cccb43355927d4ba355bc31a957ea01587f Mon Sep 17 00:00:00 2001 From: Stuart Bennett Date: Sun, 2 Dec 2007 02:14:32 +0000 Subject: [PATCH] Don't use PROM if the checksum is bad --- src/nv_bios.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nv_bios.c b/src/nv_bios.c index e3c6854..e6234f6 100644 --- a/src/nv_bios.c +++ b/src/nv_bios.c @@ -97,13 +97,13 @@ static Bool nv_cksum(const uint8_t *data, unsigned int length) return FALSE; } -static Bool NVValidVBIOS(ScrnInfoPtr pScrn, const uint8_t *data) +static int NVValidVBIOS(ScrnInfoPtr pScrn, const uint8_t *data) { /* check for BIOS signature */ if (!(data[0] == 0x55 && data[1] == 0xAA)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "... BIOS signature not found\n"); - return FALSE; + return 0; } if (nv_cksum(data, data[2] * 512)) { @@ -111,10 +111,11 @@ static Bool NVValidVBIOS(ScrnInfoPtr pScrn, const uint8_t *data) "... BIOS checksum invalid\n"); /* probably ought to set a do_not_execute flag for table parsing here, * assuming most BIOSen are valid */ + return 1; } else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "... appears to be valid\n"); - return TRUE; + return 2; } static void NVShadowVBIOS_PROM(ScrnInfoPtr pScrn, uint8_t *data) @@ -171,7 +172,7 @@ static void NVShadowVBIOS_PRAMIN(ScrnInfoPtr pScrn, uint32_t *data) static Bool NVShadowVBIOS(ScrnInfoPtr pScrn, uint32_t *data) { NVShadowVBIOS_PROM(pScrn, (uint8_t *)data); - if (NVValidVBIOS(pScrn, (uint8_t *)data)) + if (NVValidVBIOS(pScrn, (uint8_t *)data) == 2) return TRUE; NVShadowVBIOS_PRAMIN(pScrn, data); -- 2.32.0.93.g670b81a890