lkml.org 
[lkml]   [2017]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Tty: serial - Fix possible NULL derefrence.
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;
> + }

Patch now dropped as this isn't possible.

thanks,

greg k-h

\
 
 \ /
  Last update: 2017-01-30 20:38    [W:0.096 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site