[PATCH 1/3] ACPI: Make acpi_fwnode_handle safer

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

 



Check that the fwnode argument passed to acpi_fwnode_handle is non-NULL,
and return NULL if it is, otherwise the fwnode. Thus the caller doesn't
have to ensure the argument is a valid non-NULL fwnode.

Cc: stable@xxxxxxxxxxxxxxx # v5.15 and up
Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 include/acpi/acpi_bus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 53b6e9f9de7b4..c34d94521d40c 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -445,7 +445,7 @@ static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode,
 
 static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
 {
-	return &adev->fwnode;
+	return adev ? &adev->fwnode : NULL;
 }
 
 static inline void *acpi_driver_data(struct acpi_device *d)
-- 
2.30.2




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux