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: <4c2497a4-cf86-af1a-5a0b-0d980f02f152@gmail.com>
Date:   Wed, 2 Nov 2022 23:56:25 +0100
From:   Philipp Hortmann <philipp.g.hortmann@...il.com>
To:     Deepak R Varma <drv@...lo.com>, outreachy@...ts.linux.dev,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8192e: Use min_t/max_t macros for variable
 comparison

On 11/2/22 23:36, Deepak R Varma wrote:
> Simplify code by using min_t and max_t helper macros in place of lengthy
> if/else block oriented logical evaluation and value assignment. This
> issue is identified by coccicheck using the minmax.cocci file.
> 
> Use the *_t variants of min/max macros to avoid compiler warnings about
> data typecast.
> Also, use u32 as type for min_t macro to avoid any truncation of data
> associated with enum constant HT_AGG_SIZE_32K.
> 
> Signed-off-by: Deepak R Varma <drv@...lo.com>
> ---
>   drivers/staging/rtl8192e/rtl819x_HTProc.c | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
> index 62aa8e893c34..ccb86660ab48 100644
> --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
> +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
> @@ -587,17 +587,12 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
>   			else
>   				pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
>   		} else {
> -			if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
> -				pHTInfo->CurrentAMPDUFactor =
> -						 pPeerHTCap->MaxRxAMPDUFactor;
> -			else
> -				pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
> +			pHTInfo->CurrentAMPDUFactor = min_t(u32, pPeerHTCap->MaxRxAMPDUFactor,
> +							    HT_AGG_SIZE_32K);
>   		}
>   	}
> -	if (pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
> -		pHTInfo->current_mpdu_density = pHTInfo->MPDU_Density;
> -	else
> -		pHTInfo->current_mpdu_density = pPeerHTCap->MPDUDensity;
> +	pHTInfo->current_mpdu_density = max_t(u8, pHTInfo->MPDU_Density,
> +					      pPeerHTCap->MPDUDensity);
>   	if (pHTInfo->iot_action & HT_IOT_ACT_TX_USE_AMSDU_8K) {
>   		pHTInfo->bCurrentAMPDUEnable = false;
>   		pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
> --
> 2.34.1
> 
> 
> 
> 

Tested-by: Philipp Hortmann <philipp.g.hortmann@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ