[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190313180016.GB27267@kroah.com>
Date: Wed, 13 Mar 2019 11:00:16 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Aditya Pakki <pakki001@....edu>
Cc: devel@...verdev.osuosl.org, kjlu@....edu,
linux-kernel@...r.kernel.org,
Larry Finger <Larry.Finger@...inger.net>
Subject: Re: [PATCH] staging: rtl8188eu: Fix potential NULL pointer
dereference
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@....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
Powered by blists - more mailing lists