All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: Xiubo Li <Li.Xiubo@freescale.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/fb-helper: Do the mode_set.connectors ZERO_SIZE_PTR check
Date: Fri, 07 Mar 2014 10:28:57 +0200	[thread overview]
Message-ID: <87bnxi2z06.fsf@intel.com> (raw)
In-Reply-To: <1394087661-24504-1-git-send-email-Li.Xiubo@freescale.com>

On Thu, 06 Mar 2014, Xiubo Li <Li.Xiubo@freescale.com> wrote:
> Since we cannot make sure the 'max_conn_count' will always be none
> zero from the users, and then if max_conn_count equals to zero, the
> kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).
>
> So this patch fix this via doing the zero pionter check of it.

Please just add a check for max_conn_count == 0 up front and handle it.

BR,
Jani.


>
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 3d13ca6e2..c6680ef 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -536,7 +536,7 @@ int drm_fb_helper_init(struct drm_device *dev,
>  				sizeof(struct drm_connector *),
>  				GFP_KERNEL);
>  
> -		if (!fb_helper->crtc_info[i].mode_set.connectors)
> +		if (ZERO_OR_NULL_PTR(fb_helper->crtc_info[i].mode_set.connectors))
>  			goto out_free;
>  		fb_helper->crtc_info[i].mode_set.num_connectors = 0;
>  	}
> -- 
> 1.8.4
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Xiubo Li <Li.Xiubo@freescale.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: Xiubo Li <Li.Xiubo@freescale.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/fb-helper: Do the mode_set.connectors ZERO_SIZE_PTR check
Date: Fri, 07 Mar 2014 10:28:57 +0200	[thread overview]
Message-ID: <87bnxi2z06.fsf@intel.com> (raw)
In-Reply-To: <1394087661-24504-1-git-send-email-Li.Xiubo@freescale.com>

On Thu, 06 Mar 2014, Xiubo Li <Li.Xiubo@freescale.com> wrote:
> Since we cannot make sure the 'max_conn_count' will always be none
> zero from the users, and then if max_conn_count equals to zero, the
> kcalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16).
>
> So this patch fix this via doing the zero pionter check of it.

Please just add a check for max_conn_count == 0 up front and handle it.

BR,
Jani.


>
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 3d13ca6e2..c6680ef 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -536,7 +536,7 @@ int drm_fb_helper_init(struct drm_device *dev,
>  				sizeof(struct drm_connector *),
>  				GFP_KERNEL);
>  
> -		if (!fb_helper->crtc_info[i].mode_set.connectors)
> +		if (ZERO_OR_NULL_PTR(fb_helper->crtc_info[i].mode_set.connectors))
>  			goto out_free;
>  		fb_helper->crtc_info[i].mode_set.num_connectors = 0;
>  	}
> -- 
> 1.8.4
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2014-03-07  8:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  6:34 [PATCH] drm/fb-helper: Do the mode_set.connectors ZERO_SIZE_PTR check Xiubo Li
2014-03-06  6:34 ` Xiubo Li
2014-03-07  8:28 ` Jani Nikula [this message]
2014-03-07  8:28   ` Jani Nikula
2014-03-10  2:11   ` Li.Xiubo

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=87bnxi2z06.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Li.Xiubo@freescale.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.