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]
Message-ID: <0e612171-d3f0-f284-12b7-373f4da350d3@huawei.com>
Date: Wed, 6 Mar 2024 09:21:49 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: "Ricardo B. Marliere" <ricardo@...liere.net>, Richard Weinberger
	<richard@....at>, Miquel Raynal <miquel.raynal@...tlin.com>, Vignesh
 Raghavendra <vigneshr@...com>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>, Greg
 Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] mtd: ubi: make ubi_class constant

在 2024/3/6 3:35, Ricardo B. Marliere 写道:
> Since commit 43a7206b0963 ("driver core: class: make class_register() take
> a const *"), the driver core allows for struct class to be in read-only
> memory, so move the ubi_class structure to be declared at build time
> placing it into read-only memory, instead of having to be dynamically
> allocated at boot time.
> 
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@...liere.net>
> ---
>   drivers/mtd/ubi/build.c | 2 +-
>   drivers/mtd/ubi/ubi.h   | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@...wei.com>
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 7d4ff1193db6..1938b61e1b74 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -111,7 +111,7 @@ static struct attribute *ubi_class_attrs[] = {
>   ATTRIBUTE_GROUPS(ubi_class);
>   
>   /* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */
> -struct class ubi_class = {
> +const struct class ubi_class = {
>   	.name		= UBI_NAME_STR,
>   	.class_groups	= ubi_class_groups,
>   };
> diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
> index 0b42bb45dd84..21c3208a9210 100644
> --- a/drivers/mtd/ubi/ubi.h
> +++ b/drivers/mtd/ubi/ubi.h
> @@ -812,7 +812,7 @@ extern struct kmem_cache *ubi_wl_entry_slab;
>   extern const struct file_operations ubi_ctrl_cdev_operations;
>   extern const struct file_operations ubi_cdev_operations;
>   extern const struct file_operations ubi_vol_cdev_operations;
> -extern struct class ubi_class;
> +extern const struct class ubi_class;
>   extern struct mutex ubi_devices_mutex;
>   extern struct blocking_notifier_head ubi_notifiers;
>   
> 
> ---
> base-commit: 77bf032528393d2dc9430b3cea1fee8d0762a86f
> change-id: 20240305-class_cleanup-mtd-b7dfe2ea8c26
> 
> Best regards,
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ