Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4881959pjb; Mon, 27 Jul 2020 07:30:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrpTrrsZlcySO8SGA4b9sKO94m5FGKpRLI15FWwNMyDGdDr4VN3JlQMYH+H4Xu4C76B2Y5 X-Received: by 2002:aa7:c2c6:: with SMTP id m6mr6700465edp.118.1595860246876; Mon, 27 Jul 2020 07:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860246; cv=none; d=google.com; s=arc-20160816; b=IWYhM+YU63PNlMhc3xFODlo0zZXqdNVdhzBCaY+CZkPQdMzlP1nQIsskah5F9/Uo1q wp8kpsHb5CyavZ5ECvQp8XA/xSdv9fvO/A/rz4tVsz7csNKL3STwp5fedKB7qcsoJCUu 1ttfVEnPYxdtZYgk53uHviG+jePgZVYk5UrdCoPIqLzO4JNu4uk7F5b1I3UwTadddOuS pGgho0qe7c/FQx+RtHfybF2qgsLsYIEaQY6IycmEowQKdOUC1xtlnHpBN1HFYVaGp5Uc c2tU4K2wolgPe7aKZRlextLJxh7FW/QCP3Z1BvuUFxtAlOJvJ7/KzUnon+w78ceJ7aSG 3nqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KiKpGU83EgGLDoSkGD6M0vfwgj/hn/M5Jkz16UGvpOs=; b=tpA/UyiQaaY8DKKXJccZ8YR38JXYXwhni2eIUnr6eFsOtMGQTxkq1Je84Hdzst5GT+ CtcFbh4g9QIuxJ+bcRN923cL3YCw/qbiRpIdJus9tHDlwS/uZMpWtBaVgp2zwa4y19WA BMU/v8uqNf1PMUiUkkfcPSmc2z/smmPCzD/tjM1SaknNWvUonNwq/zg8PfJUw2jEzweJ pNlN59xZER5EiHwPwAbVdeI+r2eYaAJEiUQfnJzi5rSD4QUQTMIvQuoUQFvlWhGiwxmj sQk1o/cvnzQ/RefrpAN3/GNuQm6Yqg0mZxCcMrgh9+HpbRE1yMh5VTf2Il1IRYMFQZWE Hnww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xWvsPcEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv2si2322384ejb.294.2020.07.27.07.30.24; Mon, 27 Jul 2020 07:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xWvsPcEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732108AbgG0OXd (ORCPT + 99 others); Mon, 27 Jul 2020 10:23:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:52762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732070AbgG0OXb (ORCPT ); Mon, 27 Jul 2020 10:23:31 -0400 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 3166E2083E; Mon, 27 Jul 2020 14:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859810; bh=8UMyjt/AzFGIS1GD45TwNQmUI/lsxAFHKcAG7o84BZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xWvsPcEvdoDwJ5GnhwxB1zSZQMrYDwVG2sbAJKmdggbowNhc0pzrRd3jvNy+Q5i6Q +VUhcDPFLuh+SLGP9VXtgg+p/3WSQPBm6cJH2ZaTF2KY7VWfUrxShbzsjeFfS+ZcGm l66Xy33aujTBk18+7bGV+LWTdQ7fr7yA+dL55+S4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Mark Brown , Sasha Levin Subject: [PATCH 5.7 113/179] regmap: dev_get_regmap_match(): fix string comparison Date: Mon, 27 Jul 2020 16:04:48 +0200 Message-Id: <20200727134938.158461781@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Kleine-Budde [ Upstream commit e84861fec32dee8a2e62bbaa52cded6b05a2a456 ] This function is used by dev_get_regmap() to retrieve a regmap for the specified device. If the device has more than one regmap, the name parameter can be used to specify one. The code here uses a pointer comparison to check for equal strings. This however will probably always fail, as the regmap->name is allocated via kstrdup_const() from the regmap's config->name. Fix this by using strcmp() instead. Signed-off-by: Marc Kleine-Budde Link: https://lore.kernel.org/r/20200703103315.267996-1-mkl@pengutronix.de Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 320d23de02c29..927ebde1607be 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1363,7 +1363,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data) /* If the user didn't specify a name match any */ if (data) - return (*r)->name == data; + return !strcmp((*r)->name, data); else return 1; } -- 2.25.1