From patchwork Thu Oct 22 01:01:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 55238 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9M11uEI029296 for ; Thu, 22 Oct 2009 01:01:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751019AbZJVBBj (ORCPT ); Wed, 21 Oct 2009 21:01:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753537AbZJVBBj (ORCPT ); Wed, 21 Oct 2009 21:01:39 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:59269 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbZJVBBi (ORCPT ); Wed, 21 Oct 2009 21:01:38 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9M0xCpR004677; Wed, 21 Oct 2009 18:59:12 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9M11cES175202; Wed, 21 Oct 2009 19:01:38 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9M11b21014792; Wed, 21 Oct 2009 19:01:38 -0600 Received: from tux1.beaverton.ibm.com (elm3a169.beaverton.ibm.com [9.47.66.169]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n9M11bYG014780; Wed, 21 Oct 2009 19:01:37 -0600 Received: by tux1.beaverton.ibm.com (Postfix, from userid 501) id 303E913E76E; Wed, 21 Oct 2009 18:01:37 -0700 (PDT) Date: Wed, 21 Oct 2009 18:01:37 -0700 From: "Darrick J. Wong" To: Andrew Morton Cc: linux-acpi@vger.kernel.org, lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org Subject: [PATCH] acpi_power_meter: Don't leak ACPI error codes to userspace Message-ID: <20091022010137.GB21723@tux1.beaverton.ibm.com> Reply-To: djwong@us.ibm.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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,