Re: [PATCH -next] hv: vmbus: Constify struct kobj_type and struct attribute_group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 04, 2024 at 09:15:53AM +0800, Hongbo Li wrote:
> The `struct attribute_group` and `struct kobj_type` are not
> modified, and they are only used in the helpers which take a
> const type parameter.
> 
> Constifying these structure and moving them to a read-only section,
> and this can increase over all security.
> 
> ```
> [Before]
>    text   data    bss    dec    hex    filename
>   20568   4699     48  25315   62e3    drivers/hv/vmbus_drv.o
> 
> [After]
>    text   data    bss    dec    hex    filename
>   20696   4571     48  25315   62e3    drivers/hv/vmbus_drv.o
> ```
> 
> Signed-off-by: Hongbo Li <lihongbo22@xxxxxxxxxx>

Applied to hyprev-fixes, thanks.

I massage the commit message a bit to make it more readable.

> ---
>  drivers/hv/vmbus_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 7242c4920427..71fd8b97df33 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -1831,12 +1831,12 @@ static umode_t vmbus_chan_attr_is_visible(struct kobject *kobj,
>  	return attr->mode;
>  }
>  
> -static struct attribute_group vmbus_chan_group = {
> +static const struct attribute_group vmbus_chan_group = {
>  	.attrs = vmbus_chan_attrs,
>  	.is_visible = vmbus_chan_attr_is_visible
>  };
>  
> -static struct kobj_type vmbus_chan_ktype = {
> +static const struct kobj_type vmbus_chan_ktype = {
>  	.sysfs_ops = &vmbus_chan_sysfs_ops,
>  	.release = vmbus_chan_release,
>  };
> -- 
> 2.34.1
> 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux