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: <20080305141229.d79d846b.akpm@linux-foundation.org>
Date:	Wed, 5 Mar 2008 14:12:29 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	"David J. Wilder" <dwilder@...ibm.com>
Cc:	linux-kernel@...r.kernel.org, systemtap@...rceware.org,
	Andy Whitcroft <apw@...dowen.org>
Subject: Re: [patch 1/3]  Relay Reset Consumed

On Mon, 03 Mar 2008 15:51:50 -0800
"David J. Wilder" <dwilder@...ibm.com> wrote:

> This patch allows relay channels to be reset i.e. unconsumed.
> Basically allows a 'rewind' function for flight-recorder tracing.
> 
> +void relay_reset_consumed(struct rchan *chan)
> +{
> +	unsigned int i;
> +	struct rchan_buf *prev = NULL;
> +
> +	if (!chan)
> +		return;
> +
> +	for (i = 0; i < NR_CPUS; i++) {

Use of NR_CPUS is usually wrong.  In this case it seems you should be using
for_each_possible_cpu().

Also the existing usage of NR_CPUS in relay_subbufs_consumed() should be
switched to using cpu_possible().


New usage of NR_CPUS might be checkpatch-worthy, actually:

akpm:/usr/src/25> grep -l '^+.*NR_CPUS' patches/*.patch 
patches/ext4-mm-mballoc-core.patch
patches/git-kvm.patch
patches/git-perfmon.patch
patches/relay-reset-consumed.patch
patches/x86-andi-git-x86.patch
patches/x86-andi-smp-switch-optimize.patch

that's a sample of 1852 patches.

An appropriate warning would be "Usage of NR_CPUS is often wrong - should
you be using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(),
etc?".

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ