Message ID | 1382532863-30417-1-git-send-email-shaojie.sun@linaro.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBCHL7F7D4MDBBEMOT6JQKGQEENCR26A@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E2B4A20F5A for <linaro@patches.linaro.org>; Wed, 23 Oct 2013 12:54:42 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id y10sf1350175pdj.10 for <linaro@patches.linaro.org>; Wed, 23 Oct 2013 05:54:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=JBZGOBH2zuA6tv2QqKDQ9mY4UNn7t9x5bUppNDgaZiM=; b=Y1E7Xtbub2X/wnwxQuGeXZ3O9sR6Rpbz0Z3Z9hhiZTp1TNax65mHguPk4gHr45Rv2Q 0UMYO5mEU23CzA3QjLFX1tGfkHafBDw/F+NDFMMZ69fsuhIDb1rlDmbiSOBjucfoTSke y5PuBNi9UwloSlz50lI7zNCMQlQk/36cFQMlYI8TBislu2eqKDMhg1PqawRGrkLeQ5Pj JgKAP6m+SBSsdo96KP5gRbWDKeip+WGcSsLMqlipsbrLiJXU2XDex/CNdDE/NJieaDu8 6l9YWA0lXzVxOjJxHFyuwYfqcW04R873G1xHF96Ocjv5Naq1/RFJav0/maBrXKBiAqHq lAZg== X-Received: by 10.67.2.41 with SMTP id bl9mr1355191pad.16.1382532881920; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.169 with SMTP id l9ls534908qeo.97.gmail; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) X-Received: by 10.220.199.5 with SMTP id eq5mr1024785vcb.16.1382532881760; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id rl1si7180537vcb.74.2013.10.23.05.54.41 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Oct 2013 05:54:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id 10so400522vbe.5 for <patchwork-forward@linaro.org>; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) X-Gm-Message-State: ALoCoQngDeSVrxeG33vPoaj3W8PUYdgmtUf0ZcJ6KCgvRTxMTfYlVYt3eoA3c6ubI8NtFrCvxLY5 X-Received: by 10.220.192.198 with SMTP id dr6mr991889vcb.19.1382532881643; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp309369vcz; Wed, 23 Oct 2013 05:54:41 -0700 (PDT) X-Received: by 10.68.164.165 with SMTP id yr5mr1528570pbb.146.1382532880639; Wed, 23 Oct 2013 05:54:40 -0700 (PDT) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by mx.google.com with ESMTPS id u9si1990188pbf.23.2013.10.23.05.54.40 for <patches@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Oct 2013 05:54:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.171 is neither permitted nor denied by best guess record for domain of shaojie.sun@linaro.org) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id z10so1044335pdj.30 for <patches@linaro.org>; Wed, 23 Oct 2013 05:54:40 -0700 (PDT) X-Received: by 10.68.129.163 with SMTP id nx3mr1523338pbb.84.1382532879827; Wed, 23 Oct 2013 05:54:39 -0700 (PDT) Received: from localhost.localdomain ([58.251.159.202]) by mx.google.com with ESMTPSA id y9sm41069413pas.10.2013.10.23.05.54.34 for <multiple recipients> (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Oct 2013 05:54:38 -0700 (PDT) From: Shaojie Sun <shaojie.sun@linaro.org> To: mike.turquette@linaro.org Cc: private-pmwg@linaro.org, patches@linaro.org, sunshaojie@huawei.com, Shaojie Sun <shaojie.sun@linaro.com> Subject: [PATCH LINUX-CCF] clk: must judge return value of get_parent in __clk_init. Date: Wed, 23 Oct 2013 20:54:23 +0800 Message-Id: <1382532863-30417-1-git-send-email-shaojie.sun@linaro.com> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shaojie.sun@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: <patchwork-forward.linaro.org> X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe>, <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com> |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 1144e8c..fcb5c85 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1632,7 +1632,8 @@ int __clk_init(struct device *dev, struct clk *clk) hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { if (orphan->ops->get_parent) { i = orphan->ops->get_parent(orphan->hw); - if (!strcmp(clk->name, orphan->parent_names[i])) + if ((i >= 0) + && !strcmp(clk->name, orphan->parent_names[i])) __clk_reparent(orphan, clk); continue; }
For get_parent function may be return a below zero value to indicate that it couldn't find a valued parent. In this condition orphan->parent_names[i] will lead system to access an unknown memory. Signed-off-by: Shaojie Sun <shaojie.sun@linaro.com> --- drivers/clk/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)