Patch "tools/iio: Add memory allocation failure check for trigger_name" has been added to the 4.19-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

    tools/iio: Add memory allocation failure check for trigger_name

to the 4.19-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:
     tools-iio-add-memory-allocation-failure-check-for-tr.patch
and it can be found in the queue-4.19 subdirectory.

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



commit e95965403be687b26be9e5f2326ab63643b7b1de
Author: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
Date:   Wed Aug 28 02:31:29 2024 -0700

    tools/iio: Add memory allocation failure check for trigger_name
    
    [ Upstream commit 3c6b818b097dd6932859bcc3d6722a74ec5931c1 ]
    
    Added a check to handle memory allocation failure for `trigger_name`
    and return `-ENOMEM`.
    
    Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240828093129.3040-1-zhujun2@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c
index ca9f33fa51c9f..e8cf3dc8de72c 100644
--- a/tools/iio/iio_generic_buffer.c
+++ b/tools/iio/iio_generic_buffer.c
@@ -483,6 +483,10 @@ int main(int argc, char **argv)
 			return -ENOMEM;
 		}
 		trigger_name = malloc(IIO_MAX_NAME_LENGTH);
+		if (!trigger_name) {
+			ret = -ENOMEM;
+			goto error;
+		}
 		ret = read_sysfs_string("name", trig_dev_name, trigger_name);
 		free(trig_dev_name);
 		if (ret < 0) {




[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