public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Darren Jenkins <darrenrjenkins@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel mailing list <dri-devel@lists.sourceforge.net>,
	Kernel Janitors <kernel-janitors@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: drivers/gpu/drm/radeon/radeon_cp.c: check for invalid radeon family
Date: Wed, 13 Jan 2010 09:40:03 +0100	[thread overview]
Message-ID: <4B4D86E3.9090207@bfs.de> (raw)
In-Reply-To: <1261660696.3546.40.camel@ICE-BOX>



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

      reply	other threads:[~2010-01-13  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-24 13:18 drivers/gpu/drm/radeon/radeon_cp.c: check for invalid radeon family Darren Jenkins
2010-01-13  8:40 ` walter harms [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B4D86E3.9090207@bfs.de \
    --to=wharms@bfs.de \
    --cc=airlied@linux.ie \
    --cc=darrenrjenkins@gmail.com \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox