Skip to contentSkip to conversation

intel_menlow: don't set max_state a negative value

PATCH New Zhang Rui 1 participant 1 message Sep 11, 2008

Subsystems (2)
lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

PATCH 1/1 intel_menlow: don't set max_state a negative value

max_state is unsigned long.
don't set max_state a negative value

Cc : Thomas Sujith <[email protected]>

---
 drivers/misc/intel_menlow.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/misc/intel_menlow.c +4 -1
Index: linux-2.6/drivers/misc/intel_menlow.c
===================================================================
@@ -71,6 +71,9 @@
 	if (ACPI_FAILURE(status))
 		return -EFAULT;
 
+	if (!value)
+		return -EINVAL;
+
 	*max_state = value - 1;
 	return 0;
 }
@@ -121,7 +124,7 @@
 	if (memory_get_int_max_bandwidth(cdev, &max_state))
 		return -EFAULT;
 
-	if (max_state < 0 || state > max_state)
+	if (state > max_state)
 		return -EINVAL;
 
 	arg_list.count = 1;

--
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