From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Daniel Vetter <daniel@ffwll.ch>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [patch] drm: atmel-hlcdc: fix a NULL check
Date: Mon, 25 Apr 2016 11:15:43 +0200 [thread overview]
Message-ID: <20160425111543.5677b80a@bbrezillon> (raw)
In-Reply-To: <20160425090454.GA25366@mwanda>
Hi Daniel,
On Mon, 25 Apr 2016 12:04:54 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> If kmalloc() returned NULL we would end up dereferencing "state" a
> couple lines later.
Can you take this patch in drm-misc, or should I send a PR?
Regards,
Boris
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 8df0aaf..867069b 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -415,8 +415,9 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc)
> return NULL;
>
> state = kmalloc(sizeof(*state), GFP_KERNEL);
> - if (state)
> - __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
> + if (!state)
> + return NULL;
> + __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
>
> cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
> state->output_mode = cur->output_mode;
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2016-04-25 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-25 9:04 [patch] drm: atmel-hlcdc: fix a NULL check Dan Carpenter
2016-04-25 9:10 ` Boris Brezillon
2016-04-25 9:11 ` Eric Engestrom
2016-04-25 9:15 ` Boris Brezillon [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=20160425111543.5677b80a@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--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;
as well as URLs for NNTP newsgroup(s).