From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933253AbbCXRWb (ORCPT ); Tue, 24 Mar 2015 13:22:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33815 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755867AbbCXRHg (ORCPT ); Tue, 24 Mar 2015 13:07:36 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Leif Lindholm , Rob Herring Subject: [PATCH 3.19 090/123] of: handle both / and : in path strings Date: Tue, 24 Mar 2015 16:46:39 +0100 Message-Id: <20150324154428.075560242@linuxfoundation.org> X-Mailer: git-send-email 2.3.3 In-Reply-To: <20150324154423.655554012@linuxfoundation.org> References: <20150324154423.655554012@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brian Norris commit 721a09e95c786346b4188863a1cfa3909c76f690 upstream. Commit 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") caused a regression in OF handling of stdout-path. While it fixes some cases which have '/' after the ':', it breaks cases where there is more than one '/' *before* the ':'. For example, it breaks this boot string stdout-path = "/rdb/serial@f040ab00:115200"; So rather than doing sequentialized checks (first for '/', then for ':'; or vice versa), to get the correct behavior we need to check for the first occurrence of either one of them. It so happens that the handy strcspn() helper can do just that. Fixes: 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") Signed-off-by: Brian Norris Acked-by: Leif Lindholm Signed-off-by: Rob Herring Signed-off-by: Greg Kroah-Hartman --- drivers/of/base.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -715,13 +715,8 @@ static struct device_node *__of_find_nod { struct device_node *child; int len; - const char *end; - end = strchr(path, ':'); - if (!end) - end = strchrnul(path, '/'); - - len = end - path; + len = strcspn(path, "/:"); if (!len) return NULL;