Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp212392ybh; Mon, 20 Jul 2020 14:44:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN+rCKX/Tbgj/UvSm2G8LjJ1cC0nCRiG+YElEohKAR3T9t3LVh9lelTtpMUywu2zZNj4Ef X-Received: by 2002:a05:6402:1766:: with SMTP id da6mr22780766edb.48.1595281453306; Mon, 20 Jul 2020 14:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595281453; cv=none; d=google.com; s=arc-20160816; b=gAjDg48y8GX6fPaLJH9eMjMVRMLh5TsXjYqz5L0OLU1DTeD35IgbeVnv7zaX2Ho9r+ DBwIhjMilKpgDgyxxZ2A6ZfOQOoo5O17m4tXxT1tWN9laQM6ko8fQOEwgyym4vR6YTvo Pvbijk/LIpuX63AJjC3+RdGa2GLX7iRl0NC+92C6o/FNtrOsA7evIaBr7kD+plkuZNOn kEaBZcjMDQC0AxnJ9hhN9ysh/TjGBE7U5QRBD3KkKbibosl/ux8uxluTLwFOIwp/smTH YcH51vvwNdfEJ438KD0MNNsHdXVmI3ry9Ooa7YJzuTjADHUrpkU3TOMiU0xyAj5CT5PW ulFQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2mNuGZVQq1oQHVIUtHFmMvxIKmCZ76Kg6YVRmByIREg=; b=nd0kL9eOhKufhgoFr2ceNiJjENE3c0PCAZAKmzBgVqP4Up/KJ8/YdecJL/WER7XfZ1 ATEJ1+guqmbWG+anZ3QlmyN/kB3jm0tZVsonTi005fRsb7kLLHQxAUJneUrlDswIntSV o/4vU6KHhcX/VMh8YY5hGMTYdevZqd+YsLkxViONelsEDjWz4gNom2EUx1zNFNaoQEZN 14cHsOeLsm910tb9QwyZA6RG1+MMTFbFcLJng79wWsF1H5CNjEPnrb9JOfZGSxYxMaB6 Vt7STvJ/w0ZnJk6svceeKq7Lg80ryylCBJi9R3fsTOVc79AGCJXfWl/bkI5ottzP59Um PbZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jAfB7vgJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si10860020ejw.210.2020.07.20.14.43.48; Mon, 20 Jul 2020 14:44:13 -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=jAfB7vgJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbgGTVmW (ORCPT + 99 others); Mon, 20 Jul 2020 17:42:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:58084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728313AbgGTVjB (ORCPT ); Mon, 20 Jul 2020 17:39:01 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C20D320717; Mon, 20 Jul 2020 21:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595281141; bh=xAwsdarEG2CBrklf9ot9VZhvrow2vneesuNuCyiKZP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAfB7vgJ4toTGZLo9zMtVEa883YHkGjWfd7vNOeKaYMymNBItMRp6z5xntg/IZKIg x1fe22YSJAB1mCAIUFvb71l1h0ALspyKr9DHtvl8jkVnwzqE/Q+CrDctEekRUMjmNC SBCqd6nl97t9irv3LiaWeP/sT9j4eqI78Jfb1/28= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marc Kleine-Budde , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.19 08/19] regmap: dev_get_regmap_match(): fix string comparison Date: Mon, 20 Jul 2020 17:38:39 -0400 Message-Id: <20200720213851.407715-8-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720213851.407715-1-sashal@kernel.org> References: <20200720213851.407715-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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