From patchwork Thu Apr 7 09:06:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yuan X-Patchwork-Id: 692021 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3796SFt021606 for ; Thu, 7 Apr 2011 09:06:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751621Ab1DGJG3 (ORCPT ); Thu, 7 Apr 2011 05:06:29 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:50094 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049Ab1DGJG2 (ORCPT ); Thu, 7 Apr 2011 05:06:28 -0400 Received: by iwn34 with SMTP id 34so2261102iwn.19 for ; Thu, 07 Apr 2011 02:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer; bh=6MeFiTFEWDU/4SjF7rQNoohSkovl4Ef8ZHMhjnJrfkw=; b=g8lkQDN82rmCCHVNiyIpsNwewYUjGByLAiNkxy2HBJCmtvBMRZs+Ynnss8iEJ4EKpE Z6/f/Di3HfIeCpiqne7beDZI8YoDR2pnCaSh1KZFYwUmknfQyZEG2bj1e/xYD/8Pvd9i KPbxxrFUYbyzdy0G9/c3sFO+jiji61gkKS80M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=or6C0aMMgEgCNo7/AOjAE4isiuUybcQ2YL2QUcLDN9aLJN9acm9PM+3Xxt1J0WzU5H pvjzPMZafEoGVJnXVjawd55RNIIeS3pgjBFng3B0HsTaskhch4x/IFz6KUOiEj1VaXrT doIVVg3nDNannY1IGh+5cZ3o4GR4UgRuFr6uk= Received: by 10.42.156.6 with SMTP id x6mr1070635icw.90.1302167187503; Thu, 07 Apr 2011 02:06:27 -0700 (PDT) Received: from localhost.localdomain ([114.251.86.0]) by mx.google.com with ESMTPS id uk4sm901775icb.21.2011.04.07.02.06.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Apr 2011 02:06:27 -0700 (PDT) From: Liu Yuan To: Richard Purdie , Paul Mundt , linux-fbdev@vger.kernel.org, Michael Hennerich Subject: [PATCH] drivers, video: Add a check for strict_strtoul() Date: Thu, 7 Apr 2011 17:06:18 +0800 Message-Id: <1302167178-9216-1-git-send-email-namei.unix@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 07 Apr 2011 09:06:56 +0000 (UTC) From: Liu Yuan It should check if strict_strtoul() succeeds.This patch fixes it. Signed-off-by: Liu Yuan Acked-by: Michael Hennerich --- drivers/video/backlight/adp5520_bl.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index af31197..fdef632 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -212,7 +212,9 @@ static ssize_t adp5520_bl_daylight_max_store(struct device *dev, { struct adp5520_bl *data = dev_get_drvdata(dev); - strict_strtoul(buf, 10, &data->cached_daylight_max); + if (strict_strtoul(buf, 10, &data->cached_daylight_max) < 0) + return -EINVAL; + return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX); } static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show,