Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2206656ybt; Fri, 3 Jul 2020 03:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCOKXiq5X6+lhiwoFg1OFs8MONTM3HWZ9xGwe3qSPuxdcCjYmUMHH/XW5Cr0AvlOnNMIeM X-Received: by 2002:a05:6402:1346:: with SMTP id y6mr40150756edw.192.1593772625181; Fri, 03 Jul 2020 03:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593772625; cv=none; d=google.com; s=arc-20160816; b=r0o0dC3XBZ3ON6aWkUM5BDyA1HnKY+JeaDCimYojuWjTuTUBO0Jh45zsXsLOILQ/Y8 HiSCILYa5Gm+VkXKwNSjmeeqkC+nwoWkk9ZEJM7cmy/7ZT8he9wUhrJWAtrDWErc/nv7 zsN+0N6NeExncE6oUBci0p5t6/tcspcaz5hhuAq13ewsEcjP93dpwTOKmNcubcLX7G70 nH2OICCFrO/0m+9C2OoGiyURYjljBARPDiEmgNswnvIQ/zDICoFTLFudP5jLRkyp+JPj F9iVjRArXuzWl9keWjGQoq5+PL3quGxbURsYp7hRMOzDYpQI6oDUbs/ukSqBEZgLZEtV CTQQ== 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 :message-id:date:subject:cc:to:from; bh=ygT/49xcWvcSYCfARX7+wFwV/015bXB9+u7+NqT/ptQ=; b=Rqkv1ACjiplZ5oNUQ+bg0idkmgT6RVe8wBnHVC8z2ddiglvTB0hHumKCIJmGqLGAK0 LXeb897Vn139Uq2UoloySEV3sxYf92gFfjr3SPvw2lRCqyORPPiN97b/U94LIl8AwGjL cewkODv+O/1A+6vLYHkSK52GBatrHJdyCaEWTtfD43iBtwVCrWZwv7ih8rCvVMYP7Yr0 f3gGJWOpZTb6lSb22xC8P+wLHBJCxepGvNAI+LOQziUQ20siGN4nr6uAu8INSY5tLMVg h37Y1sXFrjWng93WIfCN15vtRxirbJJUHNuVP7azPOUPRwOag37iaZxKJ0sX+YH+aAhz JS4g== ARC-Authentication-Results: i=1; mx.google.com; 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 ot18si7026130ejb.303.2020.07.03.03.36.41; Fri, 03 Jul 2020 03:37:05 -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; 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 S1726236AbgGCKdS (ORCPT + 99 others); Fri, 3 Jul 2020 06:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbgGCKdS (ORCPT ); Fri, 3 Jul 2020 06:33:18 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686F3C08C5C1 for ; Fri, 3 Jul 2020 03:33:18 -0700 (PDT) Received: from heimdall.vpn.pengutronix.de ([2001:67c:670:205:1d::14] helo=blackshift.org) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1jrJ0O-0000WM-Gq; Fri, 03 Jul 2020 12:33:16 +0200 From: Marc Kleine-Budde To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Mark Brown , Marc Kleine-Budde Subject: [PATCH] regmap: dev_get_regmap_match(): fix string comparison Date: Fri, 3 Jul 2020 12:33:15 +0200 Message-Id: <20200703103315.267996-1-mkl@pengutronix.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:205:1d::14 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Hey, I stumbled over this by accident. AFAICS there's no-one on the kernel making use of the "name" parameter. regrads, Marc 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 06a796821e8b..795a62a04022 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1364,7 +1364,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.27.0