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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fea406c589526e45d9f0167628e9925f29a20217.camel@perches.com>
Date:   Sun, 20 Mar 2022 09:16:26 -0700
From:   Joe Perches <joe@...ches.com>
To:     trix@...hat.com, toke@...e.dk, kvalo@...nel.org,
        davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com
Cc:     linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ath9k: initialize arrays at compile time

On Sun, 2022-03-20 at 08:20 -0700, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
> 
> Early clearing of arrays with
> memset(array, 0, size);
> is equivilent to initializing the array in its decl with
> array[size] = { 0 };

This is true. (typo of equivalent btw)

> Since compile time is preferred over runtime,
> convert the memsets to initializations.

But this is not.

These aren't static but are stack declarations so these can not
be "initialized at compile time".

Both are zeroed at runtime, perhaps with different instructions.
Sometimes with smaller code, sometimes larger.
Sometimes faster, sometimes not.

Anyway, I think the patch is good, but the commit description is not.

> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
[]
> @@ -891,10 +891,9 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct ath_hw *ah,
>  {
>  	int i, im, nmeasurement;
>  	int magnitude, phase;
> -	u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS];
> +	u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS] = { 0 };
>  	struct ath9k_hw_cal_data *caldata = ah->caldata;
>  
> -	memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff));

etc...



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ