Re: [PATCH 1/2] clocksource/drivers/imx-sysctr: mark two variable with __ro_after_init

From: Kees Cook
Date: Thu Dec 02 2021 - 19:05:23 EST


On Wed, Dec 01, 2021 at 08:50:29PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> sys_ctr_base and cmpcr will not be updated after init, so mark
> as __ro_after_init.
>
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>

Always nice to get more of these. :)

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks!

-Kees

> ---
> drivers/clocksource/timer-imx-sysctr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c
> index 18b90fc56bfc..2b309af11266 100644
> --- a/drivers/clocksource/timer-imx-sysctr.c
> +++ b/drivers/clocksource/timer-imx-sysctr.c
> @@ -20,8 +20,8 @@
>
> #define SYS_CTR_CLK_DIV 0x3
>
> -static void __iomem *sys_ctr_base;
> -static u32 cmpcr;
> +static void __iomem *sys_ctr_base __ro_after_init;
> +static u32 cmpcr __ro_after_init;
>
> static void sysctr_timer_enable(bool enable)
> {
> --
> 2.25.1
>

--
Kees Cook