drm/nouveau: off by one in init_i2c_device_find()
authorDan Carpenter <error27@gmail.com>
Tue, 25 May 2010 09:52:27 +0000 (11:52 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 8 Jun 2010 01:03:38 +0000 (11:03 +1000)
dcb->i2c[] has DCB_MAX_NUM_I2C_ENTRIES entries.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nouveau_bios.c

index 47a27a4728daf5369d52a6779100d29723b72878..fc924b64919529cfccc14a85c3eb28ae0ab8f50d 100644 (file)
@@ -834,7 +834,7 @@ init_i2c_device_find(struct drm_device *dev, int i2c_index)
        if (i2c_index == 0x81)
                i2c_index = (dcb->i2c_default_indices & 0xf0) >> 4;
 
-       if (i2c_index > DCB_MAX_NUM_I2C_ENTRIES) {
+       if (i2c_index >= DCB_MAX_NUM_I2C_ENTRIES) {
                NV_ERROR(dev, "invalid i2c_index 0x%x\n", i2c_index);
                return NULL;
        }