[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121026035259.GO2616@ZenIV.linux.org.uk>
Date: Fri, 26 Oct 2012 04:52:59 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ming Lei <ming.lei@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] firmware loader: introduce module parameter to
customize fw search path
On Thu, Oct 25, 2012 at 08:38:25PM -0700, Linus Torvalds wrote:
> It's valid to cast a non-const pointer to a const one. It's the
> *other* way around that is invalid.
>
> So marking fw_path[] as having 'const char *' elements just means that
> we won't be changing those elements through the fw_path[] array
> (correct: we only read them). The fact that one of those same pointers
> is then also available through a non-const pointer variable means that
> they can change through *that* pointer, but that doesn't change the
> fact that fw_path[] itself contains const pointers.
>
> Remember: in C, a "const pointer" does *not* mean that the thing it
> points to cannot change. It only means that it cannot change through
> *that* pointer.
It's a bit trickier, unfortunately - pointer to pointer to const char
and pointer to pointer to char do not mix. Just for fun, try to constify
envp and argv arguments of call_usermodehelper()...
--
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