From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Shailendra Verma <shailendra.v@samsung.com>
Cc: Jiri Slaby <jslaby@suse.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
p.shailesh@samsung.com, ashish.kalra@samsung.com,
Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: Re: [PATCH] Tty: serial - Fix possible NULL derefrence.
Date: Fri, 27 Jan 2017 12:31:12 +0100 [thread overview]
Message-ID: <20170127113112.GA2042@kroah.com> (raw)
In-Reply-To: <1485515773-3542-1-git-send-email-shailendra.v@samsung.com>
On Fri, Jan 27, 2017 at 04:46:13PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/tty/serial/max310x.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index 8a3e926..a94d147 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -1323,6 +1323,10 @@ static int max310x_spi_probe(struct spi_device *spi)
> if (spi->dev.of_node) {
> const struct of_device_id *of_id =
> of_match_device(max310x_dt_ids, &spi->dev);
> + if (!of_id) {
> + dev_err(&spi->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
Have you ever hit this with a "real" system?
thanks,
greg k-h
next prev parent reply other threads:[~2017-01-27 11:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170127111619epcas4p44c21059f85b7aa091016019c98d42939@epcas4p4.samsung.com>
2017-01-27 11:16 ` [PATCH] Tty: serial - Fix possible NULL derefrence Shailendra Verma
2017-01-27 11:31 ` Greg Kroah-Hartman [this message]
2017-01-30 19:37 ` Greg Kroah-Hartman
2017-02-18 10:25 ` Maarten Brock
2017-02-18 13:06 ` Greg Kroah-Hartman
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=20170127113112.GA2042@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=ashish.kalra@samsung.com \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=p.shailesh@samsung.com \
--cc=shailendra.capricorn@gmail.com \
--cc=shailendra.v@samsung.com \
/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).