Patch "ACPI: bus: allow _UID matching for integer zero" has been added to the 6.8-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

    ACPI: bus: allow _UID matching for integer zero

to the 6.8-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:
     acpi-bus-allow-_uid-matching-for-integer-zero.patch
and it can be found in the queue-6.8 subdirectory.

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



commit 65f3c4513d59a1b0b1499dbe5345a71bf1bd7413
Author: Raag Jadav <raag.jadav@xxxxxxxxx>
Date:   Thu Mar 28 09:25:40 2024 +0530

    ACPI: bus: allow _UID matching for integer zero
    
    [ Upstream commit aca1a5287ea328fd1f7e2bfa6806646486d86a70 ]
    
    Commit b2b32a173881 ("ACPI: bus: update acpi_dev_hid_uid_match() to
    support multiple types") added _UID matching support for both integer
    and string types, which satisfies NULL @uid2 argument for string types
    using inversion, but this logic prevents _UID comparision in case the
    argument is integer 0, which may result in false positives.
    
    Fix this using _Generic(), which will allow NULL @uid2 argument for
    string types as well as _UID matching for all possible integer values.
    
    Fixes: b2b32a173881 ("ACPI: bus: update acpi_dev_hid_uid_match() to support multiple types")
    Signed-off-by: Raag Jadav <raag.jadav@xxxxxxxxx>
    [ rjw: Comment adjustment ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 446225aada50d..8b45b82cd5edc 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -911,17 +911,19 @@ static inline bool acpi_int_uid_match(struct acpi_device *adev, u64 uid2)
  * acpi_dev_hid_uid_match - Match device by supplied HID and UID
  * @adev: ACPI device to match.
  * @hid2: Hardware ID of the device.
- * @uid2: Unique ID of the device, pass 0 or NULL to not check _UID.
+ * @uid2: Unique ID of the device, pass NULL to not check _UID.
  *
  * Matches HID and UID in @adev with given @hid2 and @uid2. Absence of @uid2
  * will be treated as a match. If user wants to validate @uid2, it should be
  * done before calling this function.
  *
- * Returns: %true if matches or @uid2 is 0 or NULL, %false otherwise.
+ * Returns: %true if matches or @uid2 is NULL, %false otherwise.
  */
 #define acpi_dev_hid_uid_match(adev, hid2, uid2)			\
 	(acpi_dev_hid_match(adev, hid2) &&				\
-		(!(uid2) || acpi_dev_uid_match(adev, uid2)))
+		/* Distinguish integer 0 from NULL @uid2 */		\
+		(_Generic(uid2,	ACPI_STR_TYPES(!(uid2)), default: 0) ||	\
+		acpi_dev_uid_match(adev, uid2)))
 
 void acpi_dev_clear_dependencies(struct acpi_device *supplier);
 bool acpi_dev_ready_for_enumeration(const struct acpi_device *device);




[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