[haiku-commits] haiku: hrev48307 - src/add-ons/accelerants/radeon_hd

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 15 Nov 2014 16:26:06 +0100 (CET)

hrev48307 adds 1 changeset to branch 'master'
old head: 6a716f63ae37863fa5cc12aa2d8bccdb692d70f1
new head: a9327b111058afdb622bd9a1fddbf9e3273c453b
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a9327b1+%5E6a716f6

----------------------------------------------------------------------------

a9327b1: radeon_hd: Add additional sanity checks
  
  * Prevents negative array index read (again)
  * Clear display_mode struct before lvds read - CID 1108403

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48307
Commit:      a9327b111058afdb622bd9a1fddbf9e3273c453b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a9327b1
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Sat Nov 15 15:25:40 2014 UTC

----------------------------------------------------------------------------

1 file changed, 9 insertions(+), 1 deletion(-)
src/add-ons/accelerants/radeon_hd/connector.cpp | 10 +++++++++-

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/connector.cpp 
b/src/add-ons/accelerants/radeon_hd/connector.cpp
index 470421e..d3d44bd 100644
--- a/src/add-ons/accelerants/radeon_hd/connector.cpp
+++ b/src/add-ons/accelerants/radeon_hd/connector.cpp
@@ -9,6 +9,7 @@
 
 #include "connector.h"
 
+#include <assert.h>
 #include <Debug.h>
 
 #include "accelerant_protos.h"
@@ -152,6 +153,8 @@ connector_read_edid(uint32 connectorIndex, edid1_info* edid)
 bool
 connector_read_mode_lvds(uint32 connectorIndex, display_mode* mode)
 {
+       assert(mode);
+
        uint8 dceMajor;
        uint8 dceMinor;
        int index = GetIndexIntoMasterTable(DATA, LVDS_Info);
@@ -162,6 +165,9 @@ connector_read_mode_lvds(uint32 connectorIndex, 
display_mode* mode)
                struct _ATOM_LVDS_INFO_V12 info_12;
        };
 
+       // Wipe out display_mode
+       memset(mode, 0, sizeof(display_mode));
+
        if (atom_parse_data_header(gAtomContext, index, NULL,
                &dceMajor, &dceMinor, &offset) == B_OK) {
 
@@ -379,8 +385,10 @@ gpio_i2c_populate()
                        break;
                }
        }
-       if (gpioIndex < 0)
+       if (gpioIndex < 0) {
                ERROR("%s: ERROR: Out of space for additional GPIO pins!\n", 
__func__);
+               return B_ERROR;
+       }
 
        for (uint32 i = 0; i < numIndices; i++) {
                if (gGPIOInfo[gpioIndex]->valid) {


Other related posts:

  • » [haiku-commits] haiku: hrev48307 - src/add-ons/accelerants/radeon_hd - kallisti5