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:	Tue, 30 Oct 2007 21:42:19 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	sfr@...b.auug.org.au
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] af_key: suppress a warning for 64k pages.

From: Stephen Rothwell <sfr@...b.auug.org.au>
Date: Wed, 31 Oct 2007 15:34:22 +1100

> On Tue, 30 Oct 2007 21:08:46 -0700 (PDT) David Miller <davem@...emloft.net> wrote:
> > I think we should retain the check, but modify it so that GCC knows we
> > understand that it's OK if it is always false.  Perhaps a simple (u32)
> > cast on the left branch of the comparison is sufficient?
> 
> Unfortunately, that does not suppress the warning (gcc is getting too
> smart :-().

It seems if you break the comparison out into a function which
takes a u32, that's enough to get rid of the warning.

I can't figure out a way to make this prettier, can you?

#define PAGE_SIZE	(64 * 1024)

typedef unsigned int u32;
typedef unsigned short u16;

int compare(u32 val)
{
	if (val >= PAGE_SIZE)
		return -1;
	return 0;
}

int foo(u16 val)
{
#if 1
	return compare(val);
#else
	if (val >= PAGE_SIZE)
		return -1;
	return 0;
#endif
}
-
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