public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: djwong@us.ibm.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] [PATCH] acpi_power_meter: Don't leak ACPI error codes  to userspace
Date: Thu, 22 Oct 2009 09:27:53 +0200	[thread overview]
Message-ID: <20091022092753.1b4b9706@hyperion.delvare> (raw)
In-Reply-To: <20091022010137.GB21723@tux1.beaverton.ibm.com>

On Wed, 21 Oct 2009 18:01:37 -0700, Darrick J. Wong wrote:
> acpi-power-meter: Don't leak ACPI error codes to userspace
> 
> 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>

> ---
> 
>  drivers/acpi/power_meter.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> 
> diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
> index e6bfd77..2ef7030 100644
> --- a/drivers/acpi/power_meter.c
> +++ b/drivers/acpi/power_meter.c
> @@ -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,

-- 
Jean Delvare

  reply	other threads:[~2009-10-22  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22  1:01 [PATCH] acpi_power_meter: Don't leak ACPI error codes to userspace Darrick J. Wong
2009-10-22  7:27 ` Jean Delvare [this message]
2009-11-05 17:25   ` [lm-sensors] " Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091022092753.1b4b9706@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=akpm@linux-foundation.org \
    --cc=djwong@us.ibm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox