Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: imu: bno055: constify 'struct bin_attribute'
Date: Thu, 19 Dec 2024 17:51:57 +0000	[thread overview]
Message-ID: <20241219175157.5036bc19@jic23-huawei> (raw)
In-Reply-To: <20241215-sysfs-const-bin_attr-iio-v1-1-a5801212482e@weissschuh.net>

On Sun, 15 Dec 2024 16:21:24 +0100
Thomas Weißschuh <linux@weissschuh.net> wrote:

> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Hi Thomas

Applied to the togreg branch of iio.git, but I'll push out briefly as testing
to let 0-day take a quick look at this and the other stuff I've queued up today.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/bno055/bno055.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/imu/bno055/bno055.c b/drivers/iio/imu/bno055/bno055.c
> index 0728d38260a1c9dd218569ee870bd62c833e9906..59814de042c7d6d69547eb2adc9e1174a7e0c324 100644
> --- a/drivers/iio/imu/bno055/bno055.c
> +++ b/drivers/iio/imu/bno055/bno055.c
> @@ -1193,7 +1193,7 @@ static ssize_t serialnumber_show(struct device *dev,
>  }
>  
>  static ssize_t calibration_data_read(struct file *filp, struct kobject *kobj,
> -				     struct bin_attribute *bin_attr, char *buf,
> +				     const struct bin_attribute *bin_attr, char *buf,
>  				     loff_t pos, size_t count)
>  {
>  	struct bno055_priv *priv = iio_priv(dev_to_iio_dev(kobj_to_dev(kobj)));
> @@ -1348,16 +1348,16 @@ static struct attribute *bno055_attrs[] = {
>  	NULL
>  };
>  
> -static BIN_ATTR_RO(calibration_data, BNO055_CALDATA_LEN);
> +static const BIN_ATTR_RO(calibration_data, BNO055_CALDATA_LEN);
>  
> -static struct bin_attribute *bno055_bin_attrs[] = {
> +static const struct bin_attribute *const bno055_bin_attrs[] = {
>  	&bin_attr_calibration_data,
>  	NULL
>  };
>  
>  static const struct attribute_group bno055_attrs_group = {
>  	.attrs = bno055_attrs,
> -	.bin_attrs = bno055_bin_attrs,
> +	.bin_attrs_new = bno055_bin_attrs,
>  };
>  
>  static const struct iio_info bno055_info = {
> 
> ---
> base-commit: 2d8308bf5b67dff50262d8a9260a50113b3628c6
> change-id: 20241215-sysfs-const-bin_attr-iio-66be522330f3
> 
> Best regards,


      reply	other threads:[~2024-12-19 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15 15:21 [PATCH] iio: imu: bno055: constify 'struct bin_attribute' Thomas Weißschuh
2024-12-19 17:51 ` Jonathan Cameron [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=20241219175157.5036bc19@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    /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