linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Hongbo Li <lihongbo22@huawei.com>
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH -next] hv: vmbus: Constify struct kobj_type and struct attribute_group
Date: Thu, 5 Sep 2024 07:33:22 +0000	[thread overview]
Message-ID: <Ztlewjyvp0Td3geO@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <20240904011553.2010203-1-lihongbo22@huawei.com>

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@huawei.com>

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
> 

      parent reply	other threads:[~2024-09-05  7:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  1:15 [PATCH -next] hv: vmbus: Constify struct kobj_type and struct attribute_group Hongbo Li
2024-09-04 10:09 ` Naman Jain
2024-09-04 10:18   ` Hongbo Li
2024-09-04 11:10     ` Naman Jain
2024-09-05  1:14       ` Hongbo Li
2024-09-05  7:33 ` Wei Liu [this message]

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=Ztlewjyvp0Td3geO@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=lihongbo22@huawei.com \
    --cc=linux-hyperv@vger.kernel.org \
    /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).