Skip to contentSkip to conversation

pnpacpi: incorrect test

PATCH In review Alan Cox 2 participants 2 messages Oct 29, 2012 – Oct 30, 2012

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 pnpacpi: incorrect test

From: Alan Cox <[email protected]>

TEST_ALPHA() is broken and always returns 0

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=45171
---

 drivers/pnp/pnpacpi/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pnp/pnpacpi/core.c +1 -1
index 26b5d4b..107b6b6 100644
@@ -58,7 +58,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev)
 	if (!(('0' <= (c) && (c) <= '9') || ('A' <= (c) && (c) <= 'F'))) \
 		return 0
 #define TEST_ALPHA(c) \
-	if (!('@' <= (c) || (c) <= 'Z')) \
+	if (!('@' <= (c) && (c) <= 'Z')) \
 		return 0
 static int __init ispnpidacpi(const char *id)
 {
#1 lore raw
Quoted 15 lines · Alan Cox

From: Alan Cox <[email protected]>

TEST_ALPHA() is broken and always returns 0

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=45171
---

 drivers/pnp/pnpacpi/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pnp/pnpacpi/core.c +0 -0
index 26b5d4b..107b6b6 100644

drivers/pnp/pnpacpi/core.c static inline int __init is_exclusive_device(struct acpi_device *dev) · line 61

Quoted 5 lines
drivers/pnp/pnpacpi/core.c +1 -1
@@ -58,7 +58,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev)
        if (!(('0' <= (c) && (c) <= '9') || ('A' <= (c) && (c) <= 'F'))) \
                return 0
 #define TEST_ALPHA(c) \
-       if (!('@' <= (c) || (c) <= 'Z')) \
+       if (!('@' <= (c) && (c) <= 'Z')) \

The original is definitely broken.

I think the corrected test allows PNP IDs containing '@', which doesn't appear legal per sec 6.1.5 of the ACPI 5.0 spec. Should this be

+ if (!('A' <= (c) && (c) <= 'Z')) \

instead?

Quoted 8 lines
drivers/pnp/pnpacpi/core.c +0 -1
                return 0
 static int __init ispnpidacpi(const char *id)
 {
 
--

To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html