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:	Thu, 19 Mar 2015 08:57:56 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Borislav Petkov <bp@...e.de>
Cc:	Xie XiuQi <xiexiuqi@...wei.com>, akpm@...ux-foundation.org,
	n-horiguchi@...jp.nec.com, gong.chen@...ux.intel.com,
	bhelgaas@...gle.com, tony.luck@...el.com,
	linux-kernel@...r.kernel.org, jingle.chen@...wei.com
Subject: Re: [PATCH] trace, RAS: remove unnecessary const

On Thu, 19 Mar 2015 11:33:30 +0100
Borislav Petkov <bp@...e.de> wrote:

> On Thu, Mar 19, 2015 at 04:50:04PM +0800, Xie XiuQi wrote:
> > These parameters are passed by value. There's no need to make them const.
> 
> I can think of a reason:
> 
> include/trace/../../include/ras/ras_event.h: In function ‘ftrace_raw_event_mc_event’:
> include/trace/../../include/ras/ras_event.h:136:35: error: assignment of read-only parameter ‘top_layer’
>    __entry->top_layer  = top_layer = 12;
>                                    ^
> ---
> diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
> index 79abb9c71772..e4721eac3e25 100644
> --- a/include/ras/ras_event.h
> +++ b/include/ras/ras_event.h
> @@ -133,7 +133,7 @@ TRACE_EVENT(mc_event,
>                 __assign_str(label, label);
>                 __entry->error_count            = error_count;
>                 __entry->mc_index               = mc_index;
> -               __entry->top_layer              = top_layer;
> +               __entry->top_layer              = top_layer = 12;
>                 __entry->middle_layer           = mid_layer;
>                 __entry->lower_layer            = low_layer;
>                 __entry->address                = address;
> ---
> 
> I'm not saying it is a particularly sane reason and no one would even
> *think* of changing TP parameters passed on from higher layers in the TP
> itself but I've seen people do lotsa crazy things - things they normally
> would never do - so if it doesn't hurt having the const here, what's the
> downside of having the compiler do that sanity checking for us too?

That's a bit of a stretch. But sure, there's no real downside to having
it, except that it makes one take a double take when seeing it, and
thinking about why it would even be needed (like I did).

> 
> Steve, this is an invitation for your crazy fantasy! :-P
> 

I think you had the crazy fantasy with the above patch!


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