Patch "iio: magnetometer: yas530: Fix memchr_inv() misuse" has been added to the 5.15-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

    iio: magnetometer: yas530: Fix memchr_inv() misuse

to the 5.15-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:
     iio-magnetometer-yas530-fix-memchr_inv-misuse.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 1325dbdac6d3c89a62adcb2047d1834d3ea4967f
Author: Linus Walleij <linus.walleij@xxxxxxxxxx>
Date:   Sun May 1 21:50:29 2022 +0200

    iio: magnetometer: yas530: Fix memchr_inv() misuse
    
    [ Upstream commit bb52d3691db8cf24cea049235223f3599778f264 ]
    
    The call to check if the calibration is all zeroes is doing
    it wrong: memchr_inv() returns NULL if the the calibration
    contains all zeroes, but the check is for != NULL.
    
    Fix it up. It's probably not an urgent fix because the inner
    check for BIT(7) in data[13] will save us. But fix it.
    
    Fixes: de8860b1ed47 ("iio: magnetometer: Add driver for Yamaha YAS530")
    Reported-by: Jakob Hauser <jahau@xxxxxxxxxxxxxx>
    Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220501195029.151852-1-linus.walleij@xxxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index 9ff7b0e56cf6..b2bc637150bf 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -639,7 +639,7 @@ static int yas532_get_calibration_data(struct yas5xx *yas5xx)
 	dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
 
 	/* Sanity check, is this all zeroes? */
-	if (memchr_inv(data, 0x00, 13)) {
+	if (memchr_inv(data, 0x00, 13) == NULL) {
 		if (!(data[13] & BIT(7)))
 			dev_warn(yas5xx->dev, "calibration is blank!\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