[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YSJRYRVAP6x0lx2q@kroah.com>
Date: Sun, 22 Aug 2021 15:30:09 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc: Pavel Skripkin <paskripkin@...il.com>, Larry.Finger@...inger.net,
phil@...lpotter.co.uk, straube.linux@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Martin Kaiser <martin@...ser.cx>
Subject: Re: [PATCH RFC 0/3] staging: r8188eu: avoid uninit value bugs
On Sun, Aug 22, 2021 at 03:21:30PM +0200, Fabio M. De Francesco wrote:
> On Sunday, August 22, 2021 2:39:34 PM CEST Greg KH wrote:
> > On Sun, Aug 22, 2021 at 03:10:56PM +0300, Pavel Skripkin wrote:
> > > On 8/22/21 1:59 PM, Fabio M. De Francesco wrote:
> > > > On Sunday, August 22, 2021 12:09:29 PM CEST Pavel Skripkin wrote:
> [...]
> > > > So, it's up to the callers to test if (!_rtw_read*()) and then act
> > > > accordingly. If they get 0 they should know how to handle the errors.
> > >
> > > Yes, but _rtw_read*() == 0 indicates 2 states:
> > > 1. Error on transfer side
> > > 2. Actual register value is 0
> >
> > That's not a good design, it should be fixed. Note there is the new
> > usb_control_msg_recv() function which should probably be used instead
> > here, to prevent this problem from happening.
>
> I think that no functions should return 0 for signaling FAILURE. If I'm not
> wrong, the kernel quite always prefers to return 0 on SUCCESS and <0 on
> FAILURE. Why don't you just fix this?
Fix what specifically here? The usb_control_msg() call? If so, that is
why usb_control_msg_recv() was created, as sometimes you do want to do
what usb_control_msg() does today (see the users in the USB core today
for examples of why this is needed.)
In general, yes, 0 is success, negative is error, and positive is the
number of bytes read/written.
Anyway, let's see the second round of patches here before continuing
this thread...
thanks,
greg k-h
Powered by blists - more mailing lists