From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17C43C433E3 for ; Sun, 12 Jul 2020 17:09:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D210120725 for ; Sun, 12 Jul 2020 17:09:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="OZqzQZEo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D210120725 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AD938D0010; Sun, 12 Jul 2020 13:09:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55DB98D0003; Sun, 12 Jul 2020 13:09:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 473328D0010; Sun, 12 Jul 2020 13:09:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 32A508D0003 for ; Sun, 12 Jul 2020 13:09:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AC4D81F1B for ; Sun, 12 Jul 2020 17:09:51 +0000 (UTC) X-FDA: 77030060982.27.nose00_2c0a36026ee1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 8775C3D663 for ; Sun, 12 Jul 2020 17:09:51 +0000 (UTC) X-HE-Tag: nose00_2c0a36026ee1 X-Filterd-Recvd-Size: 3019 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sun, 12 Jul 2020 17:09:51 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8DFDF20702; Sun, 12 Jul 2020 17:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594573790; bh=a848+2Ogmip7OA1pq5ZWFjhMfOh9SLYFsM119KDBbhQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OZqzQZEoZxSAGSrZFfXjXZQUtkypTiKs2Oet5qlnQPBEPa6ZT4u2d206gYnjrbJlG BxemuBXiEumBOik0eAXItqnjOv/68W9VGr6zWzI0KQhtqMhYMb+hxYxeobXV6CpOk6 myjlUwl2om3T4Vi71OVbj9wKlmHuif0siks+8bGo= Date: Sun, 12 Jul 2020 19:09:45 +0200 From: Greg Kroah-Hartman To: Dan Williams Cc: linux-nvdimm@lists.01.org, "Rafael J. Wysocki" , peterz@infradead.org, vishal.l.verma@intel.com, dave.hansen@linux.intel.com, ard.biesheuvel@linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hch@lst.de, joao.m.martins@oracle.com Subject: Re: [PATCH v2 17/22] drivers/base: Make device_find_child_by_name() compatible with sysfs inputs Message-ID: <20200712170945.GA194499@kroah.com> References: <159457116473.754248.7879464730875147365.stgit@dwillia2-desk3.amr.corp.intel.com> <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159457125753.754248.6000936585361264069.stgit@dwillia2-desk3.amr.corp.intel.com> X-Rspamd-Queue-Id: 8775C3D663 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Jul 12, 2020 at 09:27:37AM -0700, Dan Williams wrote: > Use sysfs_streq() in device_find_child_by_name() to allow it to use a > sysfs input string that might contain a trailing newline. > > The other "device by name" interfaces, > {bus,driver,class}_find_device_by_name(), already account for sysfs > strings. > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Signed-off-by: Dan Williams > --- > drivers/base/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 67d39a90b45c..5d31b962c898 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -3078,7 +3078,7 @@ struct device *device_find_child_by_name(struct device *parent, > > klist_iter_init(&parent->p->klist_children, &i); > while ((child = next_device(&i))) > - if (!strcmp(dev_name(child), name) && get_device(child)) > + if (sysfs_streq(dev_name(child), name) && get_device(child)) Who wants to call this function with a name passed from userspace? Not objecting to it, just curious... thanks, greg k-h