From patchwork Wed Mar 21 11:10:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Daniel Kachhap X-Patchwork-Id: 7386 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8EEB423E01 for ; Wed, 21 Mar 2012 11:10:25 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3F121A18275 for ; Wed, 21 Mar 2012 11:10:25 +0000 (UTC) Received: by iage36 with SMTP id e36so1908236iag.11 for ; Wed, 21 Mar 2012 04:10:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=soW4NxGIF+lHfE+9dNgfR+iBORotEABHHOj/IE7aiHg=; b=Osv0323zSiwto1fiKrJ+sD+MZR2TCZMj349V2hnRZ3BNThaEO9zJqZV2f0awPi2kFV bDOktI5WJBrxTSB3U3wxwTWXpUGSgYYwkNlci0ZoAn6D+opY1GrVMbHVROkF3ilsd+8P K9SGYoZRsPhxORgMTlbYzlUzjX/neCNvtXV7deS3gi3/8SOJqoeNuGiD3bfjqNAWU65/ yCVhxEPF3l0l5HGcx8zRtd8oSZAuOIEyt2+ghET3W6zL+fVN32VVmocBz4Ea2Ei+lZMW bsujWmvanP44Abik7glK+J0jPSHFTDAk/B9KVuyQpLn7EKFNy+hr3DyhBAgxuIvUT2bd ChAQ== Received: by 10.50.153.193 with SMTP id vi1mr2475448igb.2.1332328224610; Wed, 21 Mar 2012 04:10:24 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.203.79 with SMTP id fh15csp7081ibb; Wed, 21 Mar 2012 04:10:23 -0700 (PDT) Received: by 10.68.125.134 with SMTP id mq6mr10301554pbb.74.1332328223209; Wed, 21 Mar 2012 04:10:23 -0700 (PDT) Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by mx.google.com with ESMTPS id t9si1650948pbv.175.2012.03.21.04.10.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Mar 2012 04:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of amitdanielk@gmail.com designates 209.85.210.44 as permitted sender) client-ip=209.85.210.44; Authentication-Results: mx.google.com; spf=pass (google.com: domain of amitdanielk@gmail.com designates 209.85.210.44 as permitted sender) smtp.mail=amitdanielk@gmail.com; dkim=pass header.i=@gmail.com Received: by dakl33 with SMTP id l33so2248378dak.17 for ; Wed, 21 Mar 2012 04:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=soW4NxGIF+lHfE+9dNgfR+iBORotEABHHOj/IE7aiHg=; b=feMRt1rnqgMcHVq8Y7j4DBNaKyyRAqTO2GZwe5t0pESyF4N7h/6WOnAnJI0E+/HTqD D8xyZ6cwWJ9a0FzTCdDGXfZuczmot4eyx3n+avQdkYpIzRMy4RKqjT2DPoSd9xkEHZE+ tR8xOHG11a17EpIMOCRA0IroOKG9gg/dEqhA0ZibCIKiJlF8XIyZrIgSG97j9T8fpYLm LQKP0AwjzkIJfh13wspvfCY2dDJCB3Za9P6w2cnN1zeUN/kGxRTn+iuvBIwE92zlM1IN IrRUQxgDkJJUlFwsZTFSkYJutdNrn/XN9/dJ1dTXFyLOTyP2lNZp7xO9vdjN1HxxNnhf AZfA== Received: by 10.68.218.168 with SMTP id ph8mr10131975pbc.51.1332328222681; Wed, 21 Mar 2012 04:10:22 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id g4sm1168863pbt.58.2012.03.21.04.10.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Mar 2012 04:10:21 -0700 (PDT) Sender: amit kachhap From: Amit Daniel Kachhap To: linux-pm@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, lenb@kernel.org, khali@linux-fr.org, linaro-dev@lists.linaro.org, amit.kachhap@linaro.org, patches@linaro.org Subject: [PATCH] thermal: Fix for setting the thermal zone mode to enable/disable Date: Wed, 21 Mar 2012 16:40:01 +0530 Message-Id: <1332328201-21191-1-git-send-email-amit.kachhap@linaro.org> X-Mailer: git-send-email 1.7.1 X-Gm-Message-State: ALoCoQk0sMYjiME7fnm1FkkUWHuPFTZMz3N57Ek1tfhrur8hnjCZhASVXXmQ0HQ9x7cL7JIVnsQD Basically without this patch changing the mode of thermal zone is not possible as wrong string size is passed to strncmp. Signed-off-by: Amit Daniel Kachhap Acked-by: Jean Delvare --- drivers/thermal/thermal_sys.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 220ce7e..96da1af 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -152,9 +152,9 @@ mode_store(struct device *dev, struct device_attribute *attr, if (!tz->ops->set_mode) return -EPERM; - if (!strncmp(buf, "enabled", sizeof("enabled"))) + if (!strncmp(buf, "enabled", sizeof("enabled") - 1)) result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED); - else if (!strncmp(buf, "disabled", sizeof("disabled"))) + else if (!strncmp(buf, "disabled", sizeof("disabled") - 1)) result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED); else result = -EINVAL;