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:	Wed, 19 Sep 2007 16:05:20 -0700
From:	Stephen Hemminger <shemminger@...ux-foundation.org>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, Ariel.Hendel@....com, greg.onufer@....com,
	jeff@...zik.org
Subject: Re: [PATCH]: Preliminary release of Sun Neptune driver

On Wed, 19 Sep 2007 15:07:55 -0700 (PDT)
David Miller <davem@...emloft.net> wrote:

> From: Stephen Hemminger <shemminger@...ux-foundation.org>
> Date: Wed, 19 Sep 2007 14:59:00 -0700
> 

...

> > > +static int niu_wait_bits_clear_mac(struct niu *np, unsigned long reg, u64 bits,
> > > +				   int limit, int delay)
> > > +{
> > > +	BUILD_BUG_ON(limit <= 0 || delay < 0);
> > 
> > There is no way compiler can evaluate limit or delay.
> 
> Check the callers, they all pass contant values.

GCC is not as smart as you think... Try the following test:
--------------------
#include <stdio.h>

#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define ENODEV -10

static int niu_wait_bits_clear_mac(void *np, unsigned long reg,
				   int limit, int delay)
{
	BUILD_BUG_ON(limit <= 0 || delay < 0);

	if (limit < 0)
		return -ENODEV;
	while (limit > 0)
		sleep(delay);
	
	return 0;
}

int main(int argc, char **argv) {
	printf("start\n");
	niu_wait_bits_clear_mac(NULL, 0, 10, 1);

	niu_wait_bits_clear_mac(NULL, 0, -1, 0);
	
	niu_wait_bits_clear_mac(NULL, 0, 0, -1);
	return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ