In the function sensor_hub_set_feature(), return error when hid_set_field()
fails.
Signed-off-by: Srinivas Pandruvada <[email protected]>
---
drivers/hid/hid-sensor-hub.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 3dd7d3246737..f9983145d4e7 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -210,16 +210,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
buffer_size = buffer_size / sizeof(__s32);
if (buffer_size) {
for (i = 0; i < buffer_size; ++i) {
- hid_set_field(report->field[field_index], i,
- (__force __s32)cpu_to_le32(*buf32));
+ ret = hid_set_field(report->field[field_index], i,
+ (__force __s32)cpu_to_le32(*buf32));
+ if (ret)
+ goto done_proc;
+
++buf32;
}
}
if (remaining_bytes) {
value = 0;
memcpy(&value, (u8 *)buf32, remaining_bytes);
- hid_set_field(report->field[field_index], i,
- (__force __s32)cpu_to_le32(value));
+ ret = hid_set_field(report->field[field_index], i,
+ (__force __s32)cpu_to_le32(value));
+ if (ret)
+ goto done_proc;
}
hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
hid_hw_wait(hsdev->hdev);
--
2.27.0
When user modifies a custom feature value and sensor_hub_set_feature()
fails, return error.
Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Srinivas Pandruvada <[email protected]>
---
Replaces patch: HID: hid-sensor-custom: remove useless variable
by Jiapeng Chong <[email protected]>
drivers/hid/hid-sensor-custom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 2628bc53ed80..58b54b127cdf 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
report_id;
ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
index, sizeof(value), &value);
+ if (ret)
+ return ret;
} else
return -EINVAL;
--
2.27.0
On Thu, 15 Apr 2021 11:52:31 -0700
Srinivas Pandruvada <[email protected]> wrote:
> In the function sensor_hub_set_feature(), return error when hid_set_field()
> fails.
>
> Signed-off-by: Srinivas Pandruvada <[email protected]>
Series applied to the to greg branch of iio.git. Note these won't make the
coming merge window, so will turn up in next sometime after rc1.
thanks,
Jonathan
> ---
> drivers/hid/hid-sensor-hub.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
> index 3dd7d3246737..f9983145d4e7 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -210,16 +210,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
> buffer_size = buffer_size / sizeof(__s32);
> if (buffer_size) {
> for (i = 0; i < buffer_size; ++i) {
> - hid_set_field(report->field[field_index], i,
> - (__force __s32)cpu_to_le32(*buf32));
> + ret = hid_set_field(report->field[field_index], i,
> + (__force __s32)cpu_to_le32(*buf32));
> + if (ret)
> + goto done_proc;
> +
> ++buf32;
> }
> }
> if (remaining_bytes) {
> value = 0;
> memcpy(&value, (u8 *)buf32, remaining_bytes);
> - hid_set_field(report->field[field_index], i,
> - (__force __s32)cpu_to_le32(value));
> + ret = hid_set_field(report->field[field_index], i,
> + (__force __s32)cpu_to_le32(value));
> + if (ret)
> + goto done_proc;
> }
> hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
> hid_hw_wait(hsdev->hdev);
On Sun, 18 Apr 2021 12:12:44 +0100
Jonathan Cameron <[email protected]> wrote:
> On Thu, 15 Apr 2021 11:52:31 -0700
> Srinivas Pandruvada <[email protected]> wrote:
>
> > In the function sensor_hub_set_feature(), return error when hid_set_field()
> > fails.
> >
> > Signed-off-by: Srinivas Pandruvada <[email protected]>
> Series applied to the to greg branch of iio.git. Note these won't make the
> coming merge window, so will turn up in next sometime after rc1.
And dropped again. Not enough caffeine today. Not in IIO obviously so instead:
Acked-by: Jonathan Cameron <[email protected]>
for both patches.
>
> thanks,
>
> Jonathan
>
> > ---
> > drivers/hid/hid-sensor-hub.c | 13 +++++++++----
> > 1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
> > index 3dd7d3246737..f9983145d4e7 100644
> > --- a/drivers/hid/hid-sensor-hub.c
> > +++ b/drivers/hid/hid-sensor-hub.c
> > @@ -210,16 +210,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
> > buffer_size = buffer_size / sizeof(__s32);
> > if (buffer_size) {
> > for (i = 0; i < buffer_size; ++i) {
> > - hid_set_field(report->field[field_index], i,
> > - (__force __s32)cpu_to_le32(*buf32));
> > + ret = hid_set_field(report->field[field_index], i,
> > + (__force __s32)cpu_to_le32(*buf32));
> > + if (ret)
> > + goto done_proc;
> > +
> > ++buf32;
> > }
> > }
> > if (remaining_bytes) {
> > value = 0;
> > memcpy(&value, (u8 *)buf32, remaining_bytes);
> > - hid_set_field(report->field[field_index], i,
> > - (__force __s32)cpu_to_le32(value));
> > + ret = hid_set_field(report->field[field_index], i,
> > + (__force __s32)cpu_to_le32(value));
> > + if (ret)
> > + goto done_proc;
> > }
> > hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
> > hid_hw_wait(hsdev->hdev);
>
On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> When user modifies a custom feature value and sensor_hub_set_feature()
> fails, return error.
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Srinivas Pandruvada <[email protected]>
> ---
> Replaces patch: HID: hid-sensor-custom: remove useless variable
> by Jiapeng Chong <[email protected]>
>
> drivers/hid/hid-sensor-custom.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> index 2628bc53ed80..58b54b127cdf 100644
> --- a/drivers/hid/hid-sensor-custom.c
> +++ b/drivers/hid/hid-sensor-custom.c
> @@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
> report_id;
> ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
> index, sizeof(value), &value);
> + if (ret)
> + return ret;
What tree is this patch against? In my tree, we're not even assigning
sensor_hub_set_feature() return value to anything.
--
Jiri Kosina
SUSE Labs
On Wed, May 5, 2021 at 2:38 PM Jiri Kosina <[email protected]> wrote:
>
> On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
>
> > When user modifies a custom feature value and sensor_hub_set_feature()
> > fails, return error.
> >
> > Reported-by: Abaci Robot <[email protected]>
> > Signed-off-by: Srinivas Pandruvada <[email protected]>
> > ---
> > Replaces patch: HID: hid-sensor-custom: remove useless variable
> > by Jiapeng Chong <[email protected]>
> >
> > drivers/hid/hid-sensor-custom.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> > index 2628bc53ed80..58b54b127cdf 100644
> > --- a/drivers/hid/hid-sensor-custom.c
> > +++ b/drivers/hid/hid-sensor-custom.c
> > @@ -406,6 +406,8 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
> > report_id;
> > ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
> > index, sizeof(value), &value);
> > + if (ret)
> > + return ret;
>
> What tree is this patch against? In my tree, we're not even assigning
> sensor_hub_set_feature() return value to anything.
>
I guess there was a "collision". At roughly the same time I merged
https://patchwork.kernel.org/project/linux-input/list/?series=456269
people were starting to send various patches for the same thing.
Srinivas, either the change in for-next (and probably Linus' master
now) is fine, or could you rebase on top of hid.git?
Cheers,
Benjamin
On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> In the function sensor_hub_set_feature(), return error when hid_set_field()
> fails.
>
> Signed-off-by: Srinivas Pandruvada <[email protected]>
Applied this one, thanks.
--
Jiri Kosina
SUSE Labs
Hi Benjamin,
On Wed, 2021-05-05 at 15:28 +0200, Benjamin Tissoires wrote:
> On Wed, May 5, 2021 at 2:38 PM Jiri Kosina <[email protected]> wrote:
> >
> > On Thu, 15 Apr 2021, Srinivas Pandruvada wrote:
> >
> > > When user modifies a custom feature value and
> > > sensor_hub_set_feature()
> > > fails, return error.
> > >
> > > Reported-by: Abaci Robot <[email protected]>
> > > Signed-off-by: Srinivas Pandruvada <
> > > [email protected]>
> > > ---
> > > Replaces patch: HID: hid-sensor-custom: remove useless variable
> > > by Jiapeng Chong <[email protected]>
> > >
> > > drivers/hid/hid-sensor-custom.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-
> > > sensor-custom.c
> > > index 2628bc53ed80..58b54b127cdf 100644
> > > --- a/drivers/hid/hid-sensor-custom.c
> > > +++ b/drivers/hid/hid-sensor-custom.c
> > > @@ -406,6 +406,8 @@ static ssize_t store_value(struct device
> > > *dev, struct device_attribute *attr,
> > >
> > > report_id;
> > > ret = sensor_hub_set_feature(sensor_inst->hsdev,
> > > report_id,
> > > index, sizeof(value),
> > > &value);
> > > + if (ret)
> > > + return ret;
> >
> > What tree is this patch against? In my tree, we're not even
> > assigning
> > sensor_hub_set_feature() return value to anything.
> >
>
> I guess there was a "collision". At roughly the same time I merged
> https://patchwork.kernel.org/project/linux-input/list/?series=456269
> people were starting to send various patches for the same thing.
>
> Srinivas, either the change in for-next (and probably Linus' master
> now) is fine, or could you rebase on top of hid.git?
>
Rebased and attached based on top of the latest mainline.
Thanks,
Srinivas
> Cheers,
> Benjamin
>
On Thu, 6 May 2021, Pandruvada, Srinivas wrote:
> Rebased and attached based on top of the latest mainline.
Applied, thanks.
--
Jiri Kosina
SUSE Labs