drm/radeon/radeon_cp.c: check for invalid radeon family
PATCH 1/1 drm/radeon/radeon_cp.c: check for invalid radeon family
If there is an invalid radeon family the fw_name is NULL and causes an NULL pointer dereference.
This just adds a check for something unexpected.
Coverity CID: 13252
Signed-off-by Darren Jenkins <[email protected]>
gpu/drm/radeon/radeon_cp.c +2 -0
@@ -531,6 +531,8 @@ static int radeon_cp_init_microcode(drm_radeon_private_t *dev_priv) ((dev_priv->flags & RADEON_FAMILY_MASK) = CHIP_RV570)) { DRM_INFO("Loading R500 Microcode\n"); fw_name = FIRMWARE_R520; + } else { +return -EINVAL ; } err =request_firmware (&dev_priv->me_fw, fw_name, &pdev->dev);
Quoted 4 lines · Darren Jenkins
If there is an invalid radeon family the
fw_nameis NULL and causes an NULL pointer dereference.
This just adds a check for something unexpected.
Same as for last one, unless a developer explicity writes code wrong, this cannot
happen, and I'd prefer a developer would see an oops.
Dave.