Patch "Input: iqs7222 - protect against undefined slider size" has been added to the 6.1-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

    Input: iqs7222 - protect against undefined slider size

to the 6.1-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:
     input-iqs7222-protect-against-undefined-slider-size.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 706a4af807794cd70663550c9f8c53519a74fd6d
Author: Jeff LaBundy <jeff@xxxxxxxxxxx>
Date:   Sat Oct 22 19:57:00 2022 -0500

    Input: iqs7222 - protect against undefined slider size
    
    [ Upstream commit 2f6fd232978906f6fb054529210b9faec384bd45 ]
    
    Select variants of silicon do not define a default slider size, in
    which case the size must be specified in the device tree. If it is
    not, the axis's maximum value is reported as 65535 due to unsigned
    integer overflow.
    
    To solve this problem, move the existing zero-check outside of the
    conditional block that checks whether the property is present.
    
    Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C")
    Signed-off-by: Jeff LaBundy <jeff@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/Y1SRXEi7XMlncDWk@nixie71
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c
index ddb863bf63ee..32515946bbca 100644
--- a/drivers/input/misc/iqs7222.c
+++ b/drivers/input/misc/iqs7222.c
@@ -2066,7 +2066,7 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index)
 		sldr_setup[4 + reg_offset] -= 2;
 
 	if (!fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val)) {
-		if (!val || val > dev_desc->sldr_res) {
+		if (val > dev_desc->sldr_res) {
 			dev_err(&client->dev, "Invalid %s size: %u\n",
 				fwnode_get_name(sldr_node), val);
 			return -EINVAL;
@@ -2081,6 +2081,13 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index)
 		}
 	}
 
+	if (!(reg_offset ? sldr_setup[3]
+			 : sldr_setup[2] & IQS7222_SLDR_SETUP_2_RES_MASK)) {
+		dev_err(&client->dev, "Undefined %s size\n",
+			fwnode_get_name(sldr_node));
+		return -EINVAL;
+	}
+
 	if (!fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val)) {
 		if (val > (reg_offset ? U16_MAX : U8_MAX * 4)) {
 			dev_err(&client->dev, "Invalid %s top speed: %u\n",



[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