From: Philipp Zabel <p.zabel@pengutronix.de>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: video-mux: fix null pointer dereferences
Date: Mon, 11 Mar 2019 10:18:18 +0100 [thread overview]
Message-ID: <1552295898.3334.3.camel@pengutronix.de> (raw)
In-Reply-To: <20190309072056.4618-1-kjlu@umn.edu>
On Sat, 2019-03-09 at 01:20 -0600, Kangjie Lu wrote:
> devm_kcalloc may fail and return a null pointer. The fix returns
> -ENOMEM upon failures to avoid null pointer dereferences.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/media/platform/video-mux.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c
> index c33900e3c23e..4135165cdabe 100644
> --- a/drivers/media/platform/video-mux.c
> +++ b/drivers/media/platform/video-mux.c
> @@ -399,9 +399,14 @@ static int video_mux_probe(struct platform_device *pdev)
> vmux->active = -1;
> vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads),
> GFP_KERNEL);
> + if (!vmux->pads)
> + return -ENOMEM;
> +
> vmux->format_mbus = devm_kcalloc(dev, num_pads,
> sizeof(*vmux->format_mbus),
> GFP_KERNEL);
> + if (!vmux->format_mbus)
> + return -ENOMEM;
>
> for (i = 0; i < num_pads; i++) {
> vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK
Thank you,
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
prev parent reply other threads:[~2019-03-11 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-09 7:20 Kangjie Lu
2019-03-11 9:18 ` Philipp Zabel [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=1552295898.3334.3.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pakki001@umn.edu \
/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
all inboxes | Powered by JetHome®