Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4867962pjb; Mon, 27 Jul 2020 07:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEWi1lHuXfsNmep0RAa5UZqqfaLlh8bptEKfLWUGiq+h3TKLemto62HaekSEgNSkz2T1NR X-Received: by 2002:a17:906:410c:: with SMTP id j12mr20861450ejk.284.1595859164709; Mon, 27 Jul 2020 07:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859164; cv=none; d=google.com; s=arc-20160816; b=uMFDw5K07WO8o0RLYqwXpOhWIuIkAh3A7sUt0hj/s0629KozGVTtqh1MAIpc21N8Jz 2Kzzl/j3e7UEklXy39BPxducLRdldKhd36JKmTPJS90iS+ZN9r8x6HUaFSC6i3k9PYrQ Wk+3N+UcO6qm6VOxebq+Kn7s5yjjqn77jft6lP76csgO3LNEZOLijynOAmuraaDKWeMw dd4MFlvNXk1aFQThcw3IwFW68iXy1XooAu//672A12LaoNmNyu6d0r9CXcATmrz7RDE2 kqopjuUxKQyLz0yCiG9YkIsv+eYIqbXCuDXygvbf+CbydxcN0gXfWEWCx9sole+Yo7g8 Yt/A== 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=2mNuGZVQq1oQHVIUtHFmMvxIKmCZ76Kg6YVRmByIREg=; b=R5G5Ld/SvvS34hTYxNr0gluSBAA1+gXfLKOS/0dkDNGmOgUOUkntzJH7vUFYo+7ovb i9n6zafwqp3lR9gi4ss6+GOvdbJwxP7pvSyVVs+ZokPvSFWQQo0pC5kSIWpaFAFOS/e1 G3Wpc/746dEybBBGucT8X99akaK/zGqF3mvYv2+IcBV+i2qrNdfpW9MM92e432UQzUW6 pNhrRIzxtwKgcyMmXOBaQzpFVvHFGCuxsxy2T9g9FB22IIlvNty1tH/Q0Ucbo9Cv5Vou tWB29eQa8Mz0/3luuraoGWoOGOknCCZaYtyODxbqFD6An+XMO0hFRRBXz//oi9rQ920S +IjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPDOtVnf; 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 o6si2303651edv.566.2020.07.27.07.12.22; Mon, 27 Jul 2020 07:12:44 -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=wPDOtVnf; 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 S1729965AbgG0OLE (ORCPT + 99 others); Mon, 27 Jul 2020 10:11:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:34232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729439AbgG0OK6 (ORCPT ); Mon, 27 Jul 2020 10:10:58 -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 C81BF208E4; Mon, 27 Jul 2020 14:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859058; bh=xAwsdarEG2CBrklf9ot9VZhvrow2vneesuNuCyiKZP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPDOtVnfgKP1Fq30y340Hm9YewH/sAD/KVIf+rQ827/6VFY3AZ3fUSxzHePzlkXej dmEih1wKe5LS03CZFpurE/Kv5GdxAZZvKAGQfYrJ3Fn9pg1g8GG1eb2ISbgmiGGruA emTPG/crhqe5ju2V9LdnaGViSIgJWqg4huESCmEo= 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 4.19 50/86] regmap: dev_get_regmap_match(): fix string comparison Date: Mon, 27 Jul 2020 16:04:24 +0200 Message-Id: <20200727134916.919700195@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@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 c7d946b745efe..d26b485ccc7d0 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1343,7 +1343,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