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]
Date:   Thu, 29 Jun 2023 11:44:34 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'You Kangren' <youkangren@...o.com>, Kalle Valo <kvalo@...nel.org>,
        Dongliang Mu <dzm91@...t.edu.cn>,
        Simon Horman <simon.horman@...igine.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        "open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER" 
        <linux-wireless@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
CC:     "opensource.kernel@...o.com" <opensource.kernel@...o.com>
Subject: RE: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator
 with min()

From: You Kangren <youkangren@...o.com>
> Sent: 27 June 2023 05:32
> 
> Replace the ternary conditional operator with min_t() to simplify the code
> 
> Signed-off-by: You Kangren <youkangren@...o.com>
> ---
>  drivers/net/wireless/legacy/ray_cs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c
> index 8ace797ce951..25edbc655738 100644
> --- a/drivers/net/wireless/legacy/ray_cs.c
> +++ b/drivers/net/wireless/legacy/ray_cs.c
> @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
>  			rx_data(dev, prcs, pkt_addr, rx_len);
> 
>  		copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr,
> -				  rx_len < sizeof(struct beacon_rx) ?
> -				  rx_len : sizeof(struct beacon_rx));
> +				  min_t(size_t, rx_len, sizeof(struct beacon_rx));

You should really consider changing the type of rx_len
before using min_t().

	David

> 
>  		local->beacon_rxed = 1;
>  		/* Get the statistics so the card counters never overflow */
> --
> 2.39.0

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ