Patch "HID: hid-sensor-custom: set fixed size for custom attributes" has been added to the 5.10-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    HID: hid-sensor-custom: set fixed size for custom attributes

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hid-hid-sensor-custom-set-fixed-size-for-custom-attr.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit afe393125b30a5edb9690816114a895880d01db9
Author: Marcus Folkesson <marcus.folkesson@xxxxxxxxx>
Date:   Thu Nov 17 13:13:26 2022 +0100

    HID: hid-sensor-custom: set fixed size for custom attributes
    
    [ Upstream commit 9d013910df22de91333a0acc81d1dbb115bd76f6 ]
    
    This is no bugfix (so no Fixes: tag is necessary) as it is
    taken care of in hid_sensor_custom_add_attributes().
    
    The motivation for this patch is that:
    hid_sensor_custom_field.attr_name and
    hid_sensor_custom_field.attrs
    has the size of HID_CUSTOM_TOTAL_ATTRS and used in same context.
    
    We compare against HID_CUSTOM_TOTAL_ATTRS when
    looping through hid_custom_attrs.
    
    We will silent the smatch error:
    hid_sensor_custom_add_attributes() error: buffer overflow
    'hid_custom_attrs' 8 <= 10
    
    Signed-off-by: Marcus Folkesson <marcus.folkesson@xxxxxxxxx>
    Acked-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 4d25577a8573..971600a6397a 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -59,7 +59,7 @@ struct hid_sensor_sample {
 	u32 raw_len;
 } __packed;
 
-static struct attribute hid_custom_attrs[] = {
+static struct attribute hid_custom_attrs[HID_CUSTOM_TOTAL_ATTRS] = {
 	{.name = "name", .mode = S_IRUGO},
 	{.name = "units", .mode = S_IRUGO},
 	{.name = "unit-expo", .mode = S_IRUGO},



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux