Patch "iio: core: Leave private pointer NULL when no private data supplied" has been added to the 6.6-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: core: Leave private pointer NULL when no private data supplied

to the 6.6-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-core-leave-private-pointer-null-when-no-private-.patch
and it can be found in the queue-6.6 subdirectory.

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



commit bcbce9fa71948dfafc2069f5163c0090ffcc70db
Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Date:   Mon Mar 4 16:04:32 2024 +0200

    iio: core: Leave private pointer NULL when no private data supplied
    
    [ Upstream commit f0245ab389330cbc1d187e358a5b890d9f5383db ]
    
    In iio_device_alloc() when size of the private data is 0,
    the private pointer is calculated to point behind the valid data.
    Leave it NULL when no private data supplied.
    
    Fixes: 6d4ebd565d15 ("iio: core: wrap IIO device into an iio_dev_opaque object")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
    Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240304140650.977784-2-andriy.shevchenko@xxxxxxxxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index feec93adb0651..5e1a85ca12119 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1649,8 +1649,10 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
 		return NULL;
 
 	indio_dev = &iio_dev_opaque->indio_dev;
-	indio_dev->priv = (char *)iio_dev_opaque +
-		ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN);
+
+	if (sizeof_priv)
+		indio_dev->priv = (char *)iio_dev_opaque +
+			ALIGN(sizeof(*iio_dev_opaque), IIO_DMA_MINALIGN);
 
 	indio_dev->dev.parent = parent;
 	indio_dev->dev.type = &iio_device_type;




[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