Skip to content

Commit

Permalink
acpi-power-meter: Don't leak ACPI error codes to userspace
Browse files Browse the repository at this point in the history
If the ACPI methods return an error code, we must return -EINVAL to userspace
to flag the error.  Right now we pass the (positive) number right through,
which causes echo to keep writing bogus values.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Darrick J. Wong authored and Len Brown committed Nov 5, 2009
1 parent 52a2b11 commit 22aeceb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/acpi/power_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource)
return -EINVAL;
}

return data;
/* _PTP returns 0 on success, nonzero otherwise */
if (data)
return -EINVAL;

return 0;
}

static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
Expand Down

0 comments on commit 22aeceb

Please sign in to comment.