From patchwork Fri Feb 18 01:54:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 572881 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1I1vmx4011403 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 18 Feb 2011 01:58:09 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p1I1tGaX019884; Thu, 17 Feb 2011 17:55:17 -0800 Received: from kirsty.vergenet.net (kirsty.vergenet.net [202.4.237.240]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p1I1tCHx019871 for ; Thu, 17 Feb 2011 17:55:13 -0800 Received: from joe.akashicho.tokyo.vergenet.net (116.58.178.162.static.zoot.jp [116.58.178.162]) by kirsty.vergenet.net (Postfix) with ESMTP id EE70224067; Fri, 18 Feb 2011 12:55:09 +1100 (EST) Received: by joe.akashicho.tokyo.vergenet.net (Postfix, from userid 7100) id BFDA828A125; Fri, 18 Feb 2011 10:55:07 +0900 (JST) From: Simon Horman To: linux-pm@lists.linux-foundation.org Date: Fri, 18 Feb 2011 10:54:56 +0900 Message-Id: <1297994096-1839-1-git-send-email-horms@verge.net.au> X-Mailer: git-send-email 1.7.2.3 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-4.831 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: Dan Carpenter , Mark Gross Subject: [linux-pm] [PATCH] PM QoS: Allow parsing of ASCII values X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Feb 2011 01:58:28 +0000 (UTC) diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index aeaa7f8..98a34ea 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c @@ -387,10 +387,11 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, if (count == sizeof(s32)) { if (copy_from_user(&value, buf, sizeof(s32))) return -EFAULT; - } else if (count == 11) { /* len('0x12345678/0') */ - if (copy_from_user(ascii_value, buf, 11)) + } else if (count == 11 || count == 10) { /* len('0x12345678\n') or + * len('0x12345678') */ + if (copy_from_user(ascii_value, buf, count)) return -EFAULT; - if (strlen(ascii_value) != 10) + if (strlen(ascii_value) != count) return -EINVAL; x = sscanf(ascii_value, "%x", &value); if (x != 1)