* [PATCH] staging: rtl8188eu: Fix potential NULL pointer dereference
@ 2019-03-13 17:11 Aditya Pakki
2019-03-13 18:00 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-13 17:11 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Larry Finger, Greg Kroah-Hartman, Michael Straube, devel,
linux-kernel
hwxmits is allocated via kcalloc and not checked for failure before its
dereference. The patch fixes this problem similar to rtl8723bs.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 1723a47a96b4..a557ed37923a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1512,6 +1512,10 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
sizeof(struct hw_xmit), GFP_KERNEL);
+ if (!pxmitpriv->hwxmits) {
+ DBG_88E("alloc hwxmits fail!...\n");
+ return;
+ }
hwxmits = pxmitpriv->hwxmits;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8188eu: Fix potential NULL pointer dereference
2019-03-13 17:11 [PATCH] staging: rtl8188eu: Fix potential NULL pointer dereference Aditya Pakki
@ 2019-03-13 18:00 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-13 18:00 UTC (permalink / raw)
To: Aditya Pakki; +Cc: devel, kjlu, linux-kernel, Larry Finger
On Wed, Mar 13, 2019 at 12:11:30PM -0500, Aditya Pakki wrote:
> hwxmits is allocated via kcalloc and not checked for failure before its
> dereference. The patch fixes this problem similar to rtl8723bs.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 1723a47a96b4..a557ed37923a 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -1512,6 +1512,10 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
>
> pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
> sizeof(struct hw_xmit), GFP_KERNEL);
> + if (!pxmitpriv->hwxmits) {
> + DBG_88E("alloc hwxmits fail!...\n");
You never need to print a message for a memory allocation failure, that
happens by the function that tried to allocate the memory.
> + return;
Shouldn't you return an error?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-13 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 17:11 [PATCH] staging: rtl8188eu: Fix potential NULL pointer dereference Aditya Pakki
2019-03-13 18:00 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).