lkml.org 
[lkml]   [2010]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: drivers/gpu/drm/radeon/radeon_cp.c: check for invalid radeon family


Darren Jenkins schrieb:
> 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 <darrenrjenkins@gmail.com>
> diff --git a/drivers/gpu/drm/radeon/radeon_cp.c
> b/drivers/gpu/drm/radeon/radeon_cp.c
> index 0b2f9c2..1e66337 100644
> --- a/drivers/gpu/drm/radeon/radeon_cp.c
> +++ b/drivers/gpu/drm/radeon/radeon_cp.c
> @@ -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);
>
>

Someone should take the job to clear the if forrest and replace it with switch()/case.

just my 2 cents,
wh


\
 
 \ /
  Last update: 2010-01-13 10:11    [W:0.069 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site