[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9eNlKNRqsar4GDb@kroah.com>
Date: Mon, 30 Jan 2023 10:27:48 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Zhou Furong <furong.zhou@...ux.intel.com>
Cc: Wesley Cheng <quic_wcheng@...cinc.com>,
srinivas.kandagatla@...aro.org, mathias.nyman@...el.com,
perex@...ex.cz, lgirdwood@...il.com, andersson@...nel.org,
krzysztof.kozlowski+dt@...aro.org, Thinh.Nguyen@...opsys.com,
broonie@...nel.org, bgoswami@...cinc.com, tiwai@...e.com,
robh+dt@...nel.org, agross@...nel.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-usb@...r.kernel.org, quic_jackp@...cinc.com,
quic_plai@...cinc.com
Subject: Re: [RFC PATCH v2 07/22] ASoC: Add SOC USB APIs for adding an USB
backend
On Mon, Jan 30, 2023 at 04:34:58PM +0800, Zhou Furong wrote:
>
>
> On 2023/1/29 15:09, Greg KH wrote:
> > On Sun, Jan 29, 2023 at 02:54:43PM +0800, Zhou Furong wrote:
> > >
> > >
> > > > > +void *snd_soc_usb_get_priv_data(struct device *usbdev)
> > > > > +{
> > > > > + struct snd_soc_usb *ctx;
> > > > > +
> > > > > + if (!usbdev)
> > > > > + return NULL;
> > > >
> > > > How could usbdev ever be NULL?
> > > The method is exported to public, valid check should be reasonable
> > > as someone may call it by mistake
> >
> > We do not protect the kernel from itself like this, no need to check
> > things that should never happen. If the caller gets it wrong, their
> > code will break :)
> >
> > thanks,
> >
> > greg k-h
>
> Thank you Greg!
>
> This has been confused me for long time when I found Linux kernel don't
> check input even for public method.
That is because we control all callers of internal kernel apis,
otherwise we would have nothing but checks all over the place that did
nothing in the end.
thanks,
greg k-h
Powered by blists - more mailing lists