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] [day] [month] [year] [list]
Message-ID: <20220222113942.1747f2dc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Tue, 22 Feb 2022 11:39:42 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     wudaemon <wudaemon@....com>
Cc:     davem@...emloft.net, chenhao288@...ilicon.com, arnd@...db.de,
        shenyang39@...wei.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: ksz884x: use time_before in netdev_open for
 compatibility

On Sun, 20 Feb 2022 12:21:01 +0000 wudaemon wrote:
> use time_before instead of direct compare for compatibility
> 
> Signed-off-by: wudaemon <wudaemon@....com>
> ---
>  drivers/net/ethernet/micrel/ksz884x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
> index d024983815da..fd3cb9ce438f 100644
> --- a/drivers/net/ethernet/micrel/ksz884x.c
> +++ b/drivers/net/ethernet/micrel/ksz884x.c
> @@ -5428,7 +5428,7 @@ static int netdev_open(struct net_device *dev)
>  		if (rc)
>  			return rc;
>  		for (i = 0; i < hw->mib_port_cnt; i++) {
> -			if (next_jiffies < jiffies)
> +			if (time_before(next_jiffies, jiffies))
>  				next_jiffies = jiffies + HZ * 2;
>  			else
>  				next_jiffies += HZ * 1;

I think this code is trying to space out the updates in time.
So neither way of doing the comparison seems great.
It'd be better to remove the static next_jiffies variable,
and just do something more akin to what mib_read_work() does
in open() as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ