lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Mar 2019 13:38:13 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Aditya Pakki <pakki001@....edu>
Cc:     devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Nathan Chancellor <natechancellor@...il.com>, kjlu@....edu,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtlwifi: Fix potential NULL pointer dereference

On Wed, Mar 13, 2019 at 11:13:34AM -0500, Aditya Pakki wrote:
> phydm.internal is allocated using kzalloc which is used multiple
> times without a check for NULL pointer. This patch avoids such a
> scenario.
> 
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
>  drivers/staging/rtlwifi/phydm/rtl_phydm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/rtlwifi/phydm/rtl_phydm.c b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> index 9930ed954abb..37c7fcb72b65 100644
> --- a/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> +++ b/drivers/staging/rtlwifi/phydm/rtl_phydm.c
> @@ -181,6 +181,9 @@ static int rtl_phydm_init_priv(struct rtl_priv *rtlpriv,
>  	rtlpriv->phydm.internal =
>  		kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL);
>  
> +	if (!rtlpriv->phydm.internal)

Don't put a blank line between the allocation and the check.  They're

part of the same code and it's weird to double space the code.

regards,
dan carpenter

Powered by blists - more mailing lists