Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nam Cao <namcaov@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] staging: rtl8712: check for alloc fail in _r8712_init_recv_priv()
Date: Tue, 25 Oct 2022 09:57:38 +0300	[thread overview]
Message-ID: <Y1eI4kTRSwEG+G6g@kadam> (raw)
In-Reply-To: <ce12408f17f90b3b368d077a7321a2a252f52b72.1666645510.git.namcaov@gmail.com>

On Mon, Oct 24, 2022 at 11:24:07PM +0200, Nam Cao wrote:
> The function _r8712_init_recv_priv() and also r8712_init_recv_priv()
> just returns silently if they fail to allocate memory. Change their
> return type to int and add necessary checks and handling if they return
> -ENOMEM
> 
> Signed-off-by: Nam Cao <namcaov@gmail.com>
> ---
>  drivers/staging/rtl8712/os_intfs.c     |  3 ++-
>  drivers/staging/rtl8712/recv_osdep.h   |  8 ++++----
>  drivers/staging/rtl8712/rtl8712_recv.c |  7 ++++---
>  drivers/staging/rtl8712/rtl871x_recv.c | 13 +++++++++----
>  4 files changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
> index 003e97205124..47d7d998fa86 100644
> --- a/drivers/staging/rtl8712/os_intfs.c
> +++ b/drivers/staging/rtl8712/os_intfs.c
> @@ -309,7 +309,8 @@ int r8712_init_drv_sw(struct _adapter *padapter)
>  	if (ret)
>  		return ret;
>  	_r8712_init_xmit_priv(&padapter->xmitpriv, padapter);
> -	_r8712_init_recv_priv(&padapter->recvpriv, padapter);
> +	ret = _r8712_init_recv_priv(&padapter->recvpriv, padapter);
> +		return ret;

If statement missing.

>  	memset((unsigned char *)&padapter->securitypriv, 0,
>  	       sizeof(struct security_priv));
>  	timer_setup(&padapter->securitypriv.tkip_timer,

regards,
dan carpenter

  reply	other threads:[~2022-10-25  6:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 21:24 [PATCH 0/4] staging: rtl8712: clean up dynamic memory management Nam Cao
2022-10-24 21:24 ` [PATCH 1/4] Revert "staging: r8712u: Tracking kmemleak false positives." Nam Cao
2022-10-24 21:24 ` [PATCH 2/4] staging: rtl8712: check for alloc fail in _r8712_init_recv_priv() Nam Cao
2022-10-25  6:57   ` Dan Carpenter [this message]
2022-10-25  8:54     ` Nam Cao
2022-10-24 21:24 ` [PATCH 3/4] staging: rtl8712: check for return value of _r8712_init_xmit_priv() Nam Cao
2022-10-24 21:24 ` [PATCH 4/4] staging: rtl8712: fix potential memory leak Nam Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1eI4kTRSwEG+G6g@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=namcaov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox