linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Bhumika Goyal <bhumirks@gmail.com>,
	Julia Lawall <julia.lawall@lip6.fr>,
	Jason Cooper <jason@lakedaemon.net>,
	andrew@lunn.ch, gregory.clement@free-electrons.com,
	sebastian.hesselbarth@gmail.com, a.zummo@towertech.it,
	alexandre.belloni@free-electrons.com,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	rtc-linux@googlegroups.com, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops
Date: Tue, 3 Jan 2017 13:18:29 -0800	[thread overview]
Message-ID: <CAGXu5jJLA=GcOhV5Z_6AOGa1KhW7fXtqBGrewEeViaJ9TiE-aw@mail.gmail.com> (raw)
In-Reply-To: <20170102140654.GF14217@n2100.armlinux.org.uk>

On Mon, Jan 2, 2017 at 6:06 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Mon, Dec 26, 2016 at 05:01:02PM +0530, Bhumika Goyal wrote:
>> The object armada38x_rtc_ops of type rtc_class_ops structure is not
>> modified after getting initialized by armada38x_rtc_probe. Apart from
>> getting referenced in init it is also passed as an argument to the function
>> devm_rtc_device_register but this argument is of type const struct
>> rtc_class_ops *. Therefore add __ro_after_init to its declaration.
>
> What I'd prefer here is for the structure to be duplicated, with one
> copy having the alarm methods and one which does not.  Both can then
> be made "const" (so placed into the read-only section at link time)
> and the probe function select between the two.
>
> I think that's a cleaner and better solution, even though it's
> slightly larger.
>
> I'm not a fan of __ro_after_init being used where other solutions are
> possible.

Can the pointer that points to the struct rtc_class_ops be made ro_after_init?

-Kees

-- 
Kees Cook
Nexus Security

  reply	other threads:[~2017-01-03 21:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 11:31 [PATCH] rtc: armada38x: add __ro_after_init to armada38x_rtc_ops Bhumika Goyal
2017-01-02 14:06 ` Russell King - ARM Linux
2017-01-03 21:18   ` Kees Cook [this message]
2017-01-03 21:31     ` Russell King - ARM Linux
2017-01-03 21:54       ` Russell King - ARM Linux
2017-01-04 10:57         ` Julia Lawall
2017-01-04 11:07           ` Alexandre Belloni
2017-01-04 11:43             ` Julia Lawall
2017-01-04 12:14               ` Russell King - ARM Linux
2017-01-04 12:23                 ` Julia Lawall
2017-01-04 13:06                   ` Russell King - ARM Linux
2017-01-04 13:41                     ` Julia Lawall
2017-01-04 21:53                     ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGXu5jJLA=GcOhV5Z_6AOGa1KhW7fXtqBGrewEeViaJ9TiE-aw@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=bhumirks@gmail.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=rtc-linux@googlegroups.com \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).