* [PATCH] driver: r8188eu: remove NULL check before vfree
@ 2022-06-14 9:03 Dongliang Mu
2022-06-14 9:18 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Dongliang Mu @ 2022-06-14 9:03 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Martin Kaiser,
Michael Straube, Pavel Skripkin
Cc: mudongliang, linux-staging, linux-kernel
From: mudongliang <mudongliangabcd@gmail.com>
vfree can handle NULL pointer as its argument.
According to coccinelle isnullfree check, remove NULL check
before vfree operation.
Signed-off-by: mudongliang <mudongliangabcd@gmail.com>
---
drivers/staging/r8188eu/os_dep/usb_intf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 68869c5daeff..bd1c8b4b5c4b 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -372,8 +372,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
free_adapter:
if (pnetdev)
rtw_free_netdev(pnetdev);
- else if (padapter)
- vfree(padapter);
+ vfree(padapter);
return NULL;
}
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver: r8188eu: remove NULL check before vfree
2022-06-14 9:03 [PATCH] driver: r8188eu: remove NULL check before vfree Dongliang Mu
@ 2022-06-14 9:18 ` Greg Kroah-Hartman
2022-06-14 9:21 ` Dongliang Mu
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-14 9:18 UTC (permalink / raw)
To: Dongliang Mu
Cc: Larry Finger, Phillip Potter, Martin Kaiser, Michael Straube,
Pavel Skripkin, mudongliang, linux-staging, linux-kernel
On Tue, Jun 14, 2022 at 05:03:30PM +0800, Dongliang Mu wrote:
> From: mudongliang <mudongliangabcd@gmail.com>
>
> vfree can handle NULL pointer as its argument.
> According to coccinelle isnullfree check, remove NULL check
> before vfree operation.
>
> Signed-off-by: mudongliang <mudongliangabcd@gmail.com>
> ---
> drivers/staging/r8188eu/os_dep/usb_intf.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> index 68869c5daeff..bd1c8b4b5c4b 100644
> --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> @@ -372,8 +372,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
> free_adapter:
> if (pnetdev)
> rtw_free_netdev(pnetdev);
> - else if (padapter)
> - vfree(padapter);
> + vfree(padapter);
You changed the logic of this code here, please be more careful in the
future.
Also, you need to use your real name for the signed-off-by and From:
line.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver: r8188eu: remove NULL check before vfree
2022-06-14 9:18 ` Greg Kroah-Hartman
@ 2022-06-14 9:21 ` Dongliang Mu
0 siblings, 0 replies; 3+ messages in thread
From: Dongliang Mu @ 2022-06-14 9:21 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dongliang Mu, Larry Finger, Phillip Potter, Martin Kaiser,
Michael Straube, Pavel Skripkin, linux-staging, linux-kernel
On Tue, Jun 14, 2022 at 5:18 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Jun 14, 2022 at 05:03:30PM +0800, Dongliang Mu wrote:
> > From: mudongliang <mudongliangabcd@gmail.com>
> >
> > vfree can handle NULL pointer as its argument.
> > According to coccinelle isnullfree check, remove NULL check
> > before vfree operation.
> >
> > Signed-off-by: mudongliang <mudongliangabcd@gmail.com>
> > ---
> > drivers/staging/r8188eu/os_dep/usb_intf.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> > index 68869c5daeff..bd1c8b4b5c4b 100644
> > --- a/drivers/staging/r8188eu/os_dep/usb_intf.c
> > +++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
> > @@ -372,8 +372,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
> > free_adapter:
> > if (pnetdev)
> > rtw_free_netdev(pnetdev);
> > - else if (padapter)
> > - vfree(padapter);
> > + vfree(padapter);
>
> You changed the logic of this code here, please be more careful in the
> future.
Oh yes, I will move vfree into the else branch. Sorry for the mistake.
>
> Also, you need to use your real name for the signed-off-by and From:
> line.
Sure.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-14 9:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 9:03 [PATCH] driver: r8188eu: remove NULL check before vfree Dongliang Mu
2022-06-14 9:18 ` Greg Kroah-Hartman
2022-06-14 9:21 ` Dongliang Mu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®