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: <20201027174718.51889f52@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Tue, 27 Oct 2020 17:47:18 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Hui Su <sh_def@....com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/atm: use list_is_singular() in br2684_setfilt()

On Tue, 27 Oct 2020 00:57:00 +0800 Hui Su wrote:
> list_is_singular() can tell whether a list has just one entry.
> So we use list_is_singular() here.
> 
> Signed-off-by: Hui Su <sh_def@....com>
> ---
>  net/atm/br2684.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/atm/br2684.c b/net/atm/br2684.c
> index 3e17a5ecaa94..398f7e086cf4 100644
> --- a/net/atm/br2684.c
> +++ b/net/atm/br2684.c
> @@ -372,8 +372,7 @@ static int br2684_setfilt(struct atm_vcc *atmvcc, void __user * arg)
>  		struct br2684_dev *brdev;
>  		read_lock(&devs_lock);
>  		brdev = BRPRIV(br2684_find_dev(&fs.ifspec));
> -		if (brdev == NULL || list_empty(&brdev->brvccs) ||
> -		    brdev->brvccs.next != brdev->brvccs.prev)	/* >1 VCC */
> +		if (brdev == NULL || !list_is_singular(&brdev->brvccs))	/* >1 VCC */

You can drop the /* >1 VCC */ comment now, the code is clear enough

>  			brvcc = NULL;
>  		else
>  			brvcc = list_entry_brvcc(brdev->brvccs.next);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ