[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2nNxp5J0XJWLOWiGxh7QiSP1SkFra3+aX5fzPSP14BTQ@mail.gmail.com>
Date: Mon, 19 Apr 2021 16:05:13 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Larry Finger <Larry.Finger@...inger.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH 37/57] staging: rtl8188eu: os_dep: ioctl_linux: Move 2
large data buffers into the heap
On Thu, Apr 15, 2021 at 7:29 AM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> On Thu, Apr 15, 2021 at 08:20:16AM +0300, Dan Carpenter wrote:
> > On Wed, Apr 14, 2021 at 07:11:09PM +0100, Lee Jones wrote:
> > > ---
> > > drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 12 +++++++++++-
> > > 1 file changed, 11 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > > index c95ae4d6a3b6b..cc14f00947781 100644
> > > --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > > +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > > @@ -224,7 +224,7 @@ static char *translate_scan(struct adapter *padapter,
> > > /* parsing WPA/WPA2 IE */
> > > {
> > > u8 *buf;
> > > - u8 wpa_ie[255], rsn_ie[255];
> > > + u8 *wpa_ie, *rsn_ie;
> > > u16 wpa_len = 0, rsn_len = 0;
> > > u8 *p;
> > >
> > > @@ -232,6 +232,14 @@ static char *translate_scan(struct adapter *padapter,
> > > if (!buf)
> > > return start;
>
> Arnd, added this return... I don't understand why we aren't returning
> -ENOMEM here.
I don't remember my patch, but I see that the function returns a pointer
that gets dereferenced afterwards. Changing this is probably a good idea
(the caller does return an error code), but it requires a few extra changes.
If there is a larger rework, I'd suggest using a single kzalloc to get all
three arrays at once to get simpler error handling.
Arnd
Powered by blists - more mailing lists