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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 27 May 2024 14:55:14 +0200
From: Arend van Spriel <arend.vanspriel@...adcom.com>
To: Erick Archer <erick.archer@...look.com>, Kalle Valo <kvalo@...nel.org>,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
 Ulf Hansson <ulf.hansson@...aro.org>,
 Christophe JAILLET <christophe.jaillet@...adoo.fr>,
 Yajun Deng <yajun.deng@...ux.dev>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Alan Stern <stern@...land.harvard.edu>, Dmitry Antipov
 <dmantipov@...dex.ru>, Johannes Berg <johannes.berg@...el.com>,
 Arnd Bergmann <arnd@...db.de>, Jonas Gorski <jonas.gorski@...il.com>,
 Artem Chernyshev <artem.chernyshev@...-soft.ru>,
 Kees Cook <keescook@...omium.org>,
 "Gustavo A. R. Silva" <gustavoars@...nel.org>,
 Justin Stitt <justinstitt@...gle.com>
Cc: linux-wireless@...r.kernel.org, brcm80211@...ts.linux.dev,
 brcm80211-dev-list.pdl@...adcom.com, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] wifi: brcm80211: use sizeof(*pointer) instead of
 sizeof(type)

On 5/26/2024 5:53 PM, Erick Archer wrote:
> It is preferred to use sizeof(*pointer) instead of sizeof(type)
> due to the type of the variable can change and one needs not
> change the former (unlike the latter). This patch has no effect
> on runtime behavior.

Thanks. A bit long list, but mostly trivial. Just a few remarks...

Acked-by: Arend van Spriel <arend.vanspriel@...adcom.com>
> Signed-off-by: Erick Archer <erick.archer@...look.com>
> ---
>   .../broadcom/brcm80211/brcmfmac/bcmsdh.c      |  4 ++--
>   .../broadcom/brcm80211/brcmfmac/btcoex.c      |  2 +-
>   .../broadcom/brcm80211/brcmfmac/sdio.c        |  2 +-
>   .../broadcom/brcm80211/brcmfmac/usb.c         |  2 +-
>   .../broadcom/brcm80211/brcmsmac/aiutils.c     |  2 +-
>   .../broadcom/brcm80211/brcmsmac/ampdu.c       |  2 +-
>   .../broadcom/brcm80211/brcmsmac/antsel.c      |  2 +-
>   .../broadcom/brcm80211/brcmsmac/channel.c     |  2 +-
>   .../broadcom/brcm80211/brcmsmac/dma.c         |  2 +-
>   .../broadcom/brcm80211/brcmsmac/mac80211_if.c |  2 +-
>   .../broadcom/brcm80211/brcmsmac/main.c        | 23 +++++++++----------
>   .../broadcom/brcm80211/brcmsmac/phy/phy_cmn.c |  4 ++--
>   .../broadcom/brcm80211/brcmsmac/phy/phy_lcn.c |  2 +-
>   .../broadcom/brcm80211/brcmsmac/phy_shim.c    |  2 +-
>   14 files changed, 26 insertions(+), 27 deletions(-)

[...]

> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> index aae2cf95fe95..8696061bf2dd 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> @@ -4968,7 +4968,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
>   {
>   	struct brcms_phy_lcnphy *pi_lcn;
>   
> -	pi->u.pi_lcnphy = kzalloc(sizeof(struct brcms_phy_lcnphy), GFP_ATOMIC);
> +	pi->u.pi_lcnphy = kzalloc(sizeof(*pi->u.pi_lcnphy), GFP_ATOMIC);
Better use pi_lcn here and assign it to pi->u.pi_lcnphy after the 
if-statement.

>   	if (pi->u.pi_lcnphy == NULL)
>   		return false;
>   
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
> index b72381791536..4b916f3a087b 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy_shim.c
> @@ -40,7 +40,7 @@ struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,
>   					  struct brcms_c_info *wlc) {
>   	struct phy_shim_info *physhim = NULL;

While at it please remove the redundant NULL initialization.

> -	physhim = kzalloc(sizeof(struct phy_shim_info), GFP_ATOMIC);
> +	physhim = kzalloc(sizeof(*physhim), GFP_ATOMIC);
>   	if (!physhim)
>   		return NULL;
>   

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4219 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ