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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 May 2011 09:08:34 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Eduardo Silva <edsiper@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel: Fix ftrace.c compiler warning when calling
 ftrace_nop_replace()

On Sun, 2011-05-22 at 18:36 -0700, H. Peter Anvin wrote:
> On 05/22/2011 06:19 PM, Eduardo Silva wrote:
> > the function ftrace_nop_replace() returns a 'static const unsigned char *'
> > value, so when the caller perform a direct assignment to a
> > 'static unsigned char *', the compiler raise the following warning message:
> > 
> >  ftrace.c:308:6: warning: assignment discards qualifiers from pointer target type
> >  ftrace.c:318:6: warning: assignment discards qualifiers from pointer target type
> > 
> > Adding the proper casts the message goes away.
> > 
> > Signed-off-by: Eduardo Silva <edsiper@...il.com>
> 
> This quiets a warning of something that potentially looks like a real
> bug.  Perhaps "new" should be const?

Although there is no real bug here, I hate these "hide the warning"
patches.

The real solution is to change all the users into const *. This should
be doable as the new and old pointers are not modified.

And remember:

	char *changes;
	const char *no_changes;

	no_changes = changes;  /* is OK! (no compiler warnings) */

	changes = no_changes; /* is not OK. (compiler will warn). */

-- Steve


--
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