lkml.org 
[lkml]   [2021]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] tty: serial: fsl_lpuart: fix the potential bug of dereference null return value
Hi Sherry,

On Mon, Apr 26, 2021 at 8:39 AM Sherry Sun <sherry.sun@nxp.com> wrote:

> > > + if (!sdata)
> > > + return -ENODEV;
> >
> > How can sdata be NULL?
>
> Is it possible that a case forgot to set sdata? Then the value will be NULL, such as { .compatible = "fsl,imx8qxp-lpuart", }.
> So I added the patch to avoid the kernel crash when run to sdata->reg_off directly. But I am not sure does it make sense.

sdata comes directly from of_device_get_match_data().

This driver only runs on DT platforms and the only way of being probed
is when a compatible string matches, so it is not possible that sdata
can be NULL.

\
 
 \ /
  Last update: 2021-04-26 14:00    [W:0.703 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site