[lkml]   [2016]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 25/26] pch_gbe: constify local structures

On Sun, 11 Sep 2016, David Miller wrote:

> Julia, I went over the networking driver patches in this series and
> I have to say that I'd rather see these changes be more durable
> and self-checking.
> By this I mean that I want you to also make the driver private pointer
> that holds these structures be const too.

Sorry, I'm not sure what you are asking for. In these cases, we often end
up with something like:

static const struct foo = { ... };

and then later

xxx.ops = foo;

So foo is protected, but its lifetime of interest is quite short. But we
can't set the ops field of the type of xxx to be const either, because it
is obviously not - the code above modifies it. Everything would be fine
if ops were of pointer type but not structure type, but that is not the
case in this patch series, because the semantic patch disallows &foo.
There is the __ro_after_init annotation that might help in some cases, but
I have often seen these assignments in probe functions that are not
__init. Kees Cook mentioned some code that could be inserted before and
after an assignment to make a field temporarily writeable, but I haven't
looked into that possibility yet.

Have I misunderstood something?


> Then if there are really any assignments to the objects being marked
> const, it will show immediately.
> Thank you.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to
> More majordomo info at

 \ /
  Last update: 2016-09-17 09:59    [W:0.084 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site