Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp913474ybv; Thu, 20 Feb 2020 09:28:16 -0800 (PST) X-Google-Smtp-Source: APXvYqx/GcKnNqylb2cBOzxWJp1RlwDBxARMsjO4Ft/AwUSkefdwwO3yliA2ZD2J2W6+oEcyHUIz X-Received: by 2002:aca:f1c6:: with SMTP id p189mr2917881oih.159.1582219695866; Thu, 20 Feb 2020 09:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582219695; cv=none; d=google.com; s=arc-20160816; b=Vx1sP3eBYnMnKS5AuDxgfHU2oiQPzUT5gkdlb0j2PWCYITeYyCdLy1OYky+2+zZlGX WMndK6V3xghDn0ohTRIKmSdCjhXtwMbiW0r3PLancCIFdPp1RfwVsbZvRqP/13mlgFg/ hCOvLGsSkTAh6X4vLCi5/J6xwK/Sv+B3XKiw1PNu9nMj7pa0OsquAaA5gF7/ibKqYG15 B8LvmGfbgShW8B/qYntnnLOYuGhQUrY22nPI15Io6FJobw/ihDtOLdDISMYGr2yGI8Gd GyvNfUL0qE9gs83qBZnvenue1dzGcQ5daxKEc9pK8mTeImFPGkOEcN2yVkOQ/asdTywu Ql4Q== 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; bh=NEiujecx9Ah2/FoboD5BvkodSmcm4Z+ysHED6/4dF64=; b=tJoirL3wca/q937mF2XpsCIK1oIaOgFW3zoQtJX4mp/EjTEiRWhTn6qqXKkV8efDsR MCKVU7zqzgCSU0tH4dQHXfn4QLiLBfGwO8Q+B4wcxRhuNSffVwnlfE5FDC8OGVmygK/D FLE+mYvtYEg4BlQoRwkqCWBPqaAC7Qks33yBZjrq5uoEKPlZpQdmJc8Zr7K/lStXioQP H/jg2y/q1teO+svMWBjMq2YKzxim+qOa68HKX66aNBq/gCjtpqDd+8cMZecerZVPqjN9 C9fB5NG9bY/Y3M2Bw2cfuThyDkeTJ9cPo9DXdC2qa4jpChKvjj8lfeMEPt5990Rk5okS pFaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k125si10400892oib.212.2020.02.20.09.28.03; Thu, 20 Feb 2020 09:28:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbgBTRZy (ORCPT + 99 others); Thu, 20 Feb 2020 12:25:54 -0500 Received: from sauhun.de ([88.99.104.3]:35042 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728706AbgBTRZy (ORCPT ); Thu, 20 Feb 2020 12:25:54 -0500 Received: from localhost (p5486CC48.dip0.t-ipconnect.de [84.134.204.72]) by pokefinder.org (Postfix) with ESMTPSA id D7BF52C1EBA; Thu, 20 Feb 2020 18:25:50 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, linux-i3c@lists.infradead.org, Kieran Bingham , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Luca Ceresoli , Jacopo Mondi , Laurent Pinchart , Vladimir Zapolskiy , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Wolfram Sang Subject: [RFC PATCH 1/7] i2c: add sanity check for parameter of i2c_verify_client() Date: Thu, 20 Feb 2020 18:23:57 +0100 Message-Id: <20200220172403.26062-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200220172403.26062-1-wsa+renesas@sang-engineering.com> References: <20200220172403.26062-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We export this function, so we should check the paramter to make it NULL-compatible. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index cefad0881942..8f46d1bb8c62 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -517,7 +517,7 @@ EXPORT_SYMBOL_GPL(i2c_client_type); */ struct i2c_client *i2c_verify_client(struct device *dev) { - return (dev->type == &i2c_client_type) + return (dev && dev->type == &i2c_client_type) ? to_i2c_client(dev) : NULL; } -- 2.20.1