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]
Date:   Sat, 6 Mar 2021 17:05:29 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Ye Xiang <xiang.ye@...el.com>
Cc:     jikos@...nel.org, srinivas.pandruvada@...ux.intel.com,
        linux-input@...r.kernel.org, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] iio: hid-sensor-humidity: Fix alignment issue of
 timestamp channel

On Wed,  3 Mar 2021 14:36:12 +0800
Ye Xiang <xiang.ye@...el.com> wrote:

> This patch ensures that, there is sufficient space and correct
> alignment for the timestamp.
> 
> Fixes: d7ed89d5aadf ("iio: hid: Add humidity sensor support")
> Signed-off-by: Ye Xiang <xiang.ye@...el.com>
ouch.  I guess we were trampling over the next few elements and somehow
getting away with it (mostly).

Applied to the fixes-togreg branch of iio.git and marked for stable.

As the next patch isn't a fix, we'll have to wait for this to get
upstream and round the loop so I can apply the next patch via the
slower path.  Give me a poke if I seem to have lost it once the
dependency is in my togreg branch.

thanks,

Jonathan


> ---
>  drivers/iio/humidity/hid-sensor-humidity.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
> index ec88ae3f233d..74383abc0d44 100644
> --- a/drivers/iio/humidity/hid-sensor-humidity.c
> +++ b/drivers/iio/humidity/hid-sensor-humidity.c
> @@ -15,7 +15,10 @@
>  struct hid_humidity_state {
>  	struct hid_sensor_common common_attributes;
>  	struct hid_sensor_hub_attribute_info humidity_attr;
> -	s32 humidity_data;
> +	struct {
> +		s32 humidity_data;
> +		u64 timestamp __aligned(8);
> +	} scan;
>  	int scale_pre_decml;
>  	int scale_post_decml;
>  	int scale_precision;
> @@ -129,9 +132,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
>  	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
>  
>  	if (atomic_read(&humid_st->common_attributes.data_ready))
> -		iio_push_to_buffers_with_timestamp(indio_dev,
> -					&humid_st->humidity_data,
> -					iio_get_time_ns(indio_dev));
> +		iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
> +						   iio_get_time_ns(indio_dev));
>  
>  	return 0;
>  }
> @@ -146,7 +148,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,
>  
>  	switch (usage_id) {
>  	case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
> -		humid_st->humidity_data = *(s32 *)raw_data;
> +		humid_st->scan.humidity_data = *(s32 *)raw_data;
>  
>  		return 0;
>  	default:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ