Skip to contentSkip to conversation

drm/radeon/r100.c: check for invalid family

PATCH NAK Darren Jenkins 2 participants 2 messages Dec 30, 2009 – Jan 7, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/r100.c: check for invalid family

If there is an invalid family the fw_name is NULL and causes an NULL pointer dereference.
This just adds a check for something unexpected.

Coverity CID: 13251

gpu/drm/radeon/r100.c +2 -0
index 7172746..e4b9770 100644
@@ -584,6 +584,8 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
 		   (rdev->family = CHIP_RV570)) {
 		DRM_INFO("Loading R500 Microcode\n");
 		fw_name = FIRMWARE_R520;
+	} else {
+		return -EINVAL;
 	}
 
 	err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev);
#1 lore raw
Quoted 3 lines · Darren Jenkins

If there is an invalid family the fw_name is NULL and causes an NULL pointer dereference.
This just adds a check for something unexpected.

NAK.

This can't happen, only gpus with those families set can call this function, so we can't get in here without the correct family, and if we did it would be due to developer error, so oopsing is very appropriate.

Dave.

Quoted 26 lines

Coverity CID: 13251

gpu/drm/radeon/r100.c +2 -1
index 7172746..e4b9770 100644
@@ -584,6 +584,8 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
                   (rdev->family == CHIP_RV570)) {
                DRM_INFO("Loading R500 Microcode\n");
                fw_name = FIRMWARE_R520;
+       } else {
+               return -EINVAL;
        }
 
        err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev);
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/