diff mbox

drm/bridge: checking the wrong variable

Message ID 20150128064335.GC30893@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Jan. 28, 2015, 6:43 a.m. UTC
We were supposed to check "fmts" here instead of "formats".  I suppose
it eventually leads to a NULL dereference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Daniel Kurtz Jan. 28, 2015, 6:46 a.m. UTC | #1
Hi Dan,

nit: this patch is not really for "drm/bridge".

On Wed, Jan 28, 2015 at 2:43 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> We were supposed to check "fmts" here instead of "formats".  I suppose
> it eventually leads to a NULL dereference.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>

Otherwise, good catch!

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 98fb640..8ae239f 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -783,7 +783,7 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
>         if (formats && num_formats) {
>                 fmts = kmemdup(formats, sizeof(*formats) * num_formats,
>                                GFP_KERNEL);
> -               if (!formats)
> +               if (!fmts)
>                         return -ENOMEM;
>         }
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Thierry Reding Jan. 28, 2015, 7:59 a.m. UTC | #2
On Wed, Jan 28, 2015 at 02:46:46PM +0800, Daniel Kurtz wrote:
> Hi Dan,
> 
> nit: this patch is not really for "drm/bridge".
> 
> On Wed, Jan 28, 2015 at 2:43 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > We were supposed to check "fmts" here instead of "formats".  I suppose
> > it eventually leads to a NULL dereference.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> 
> Otherwise, good catch!
> 
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

I've reworded the commit message slightly and applied this. Thanks.

Thierry
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 98fb640..8ae239f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -783,7 +783,7 @@  int drm_display_info_set_bus_formats(struct drm_display_info *info,
 	if (formats && num_formats) {
 		fmts = kmemdup(formats, sizeof(*formats) * num_formats,
 			       GFP_KERNEL);
-		if (!formats)
+		if (!fmts)
 			return -ENOMEM;
 	}