Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp649012lqp; Sun, 9 Jun 2024 12:38:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3Gce/cOzRN4zQPO8eYER7a++Ig3e1go3DW/XkCVEan3yTsR3xCLiFMVLzB0Uj/oD5zpkcmXtuK7282rYaj+3UBxdH0jp/s93GoWnVjA== X-Google-Smtp-Source: AGHT+IG3x398LZzg9t1EF5P2S/rgVobDqmiE5LFOh6JlplKds2d7VRUiPEUIKUapZPmXf2NOUqTk X-Received: by 2002:a05:6358:50c6:b0:19f:4d7e:af92 with SMTP id e5c5f4694b2df-19f4d7eb5e4mr272309555d.26.1717961939562; Sun, 09 Jun 2024 12:38:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717961939; cv=pass; d=google.com; s=arc-20160816; b=k7T0PkNRnBbkdrIYLBd+Vyli5BM8aHdIq+dZzGfcH8chagDdw0aGmzMKSNL4i/PnH6 KqgX9pTCl5J7+ycC7ITyt7qw3M91FLje8kHSSeLvBCUyRibL5Dw9HbuCM273dCq54Ve9 ralLrF9UWRqeC84eAGHVR23gJa8hnDKokZFFSNM7eul32JmRedb0TfCIH/LaYs5XX8oW bbo/4gbQPpGEaVWU1Kyn9e8nMA4z5pp0Iw20r9Z7jzZu0Ygxz2xJHq/apGBOoVOU60c+ ZHJxeRhcyjNDE8HiNDdwB6rubX5dEkjVKpt8zTa8BH3u8mLPfcs78YKcQsKwZiGyjAOm mwIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uFG9zs+TOxLu+QRcet0jDU4W7tv1prViIcV9q7WG5hg=; fh=JEKocL2NCPxSyQH8cFAAHNSmlgRWjtPyH4w9hztIYkg=; b=nKNOqIrqL1anbKwgGQq+7F1Ra+d2gd8kkRvnqyVAIfcM9Xwa1raOkz+tccly/ssDOv 1Tb/Jn//YVwf738utnqMiun8crUhRsR/7xLXFczajP9yItC4oOlNdqP71lqEinEWWqKR 8++DzzYhep2p+82p0Dgdo/W4r3X+6wVQ5QQD4FKd0aaSVR5YQz98U/YqZ6/SloJqXORx ruePXR+41nyn+LeuC5u+sOI3hVwWhs9wUj0AzpK6Zafrz8gNol0RhmRufNF6amVaaMth vlzRp67CxcHEvB+LgGaG/9Ci68YILfi/3NIhRSIm6tQxuapv5kIkd/c6iiirCVxrKnOj nDYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UrjfdEUi; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-207494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2a37c275si6668387a12.811.2024.06.09.12.38.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 12:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UrjfdEUi; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-207494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 283B5B20C0C for ; Sun, 9 Jun 2024 19:38:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE1E1446B4; Sun, 9 Jun 2024 19:38:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UrjfdEUi" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A704418B14 for ; Sun, 9 Jun 2024 19:38:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717961926; cv=none; b=ser05PLMrxGlNd/30CwZMuy2fyUD12Thhm80376yrCHzCDmRvODfEzM24jMoRoVS5SIUu1AT1VNkamhzzXp9/b06NUB/lxtOqNgrSx/qBOy8WPlwW46ftdyRJDyGairrk32NmtSRjcEaFjpdJhVQ5Ud/r3Az1w2XP2TyZOmSCUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717961926; c=relaxed/simple; bh=7Co9P7eOY4NGJgNk6IY4rYXcNj4Y5wPFEiwIBYemaKo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ei1nSjveK0n73ZjKH3VvUzb8e3vcxYK6/ZW7i5UKDiZ3nvaEFIQWFx1nFIMe3iqcW2pC3E64eAUHidawHEbclvMBCGaC/HnVg6oagZJb6YGacwkMmPCGmEFvpPHP/xIBrQy7VEuUAqMWdKIY05KhGiKLsbejd0jKXyT7MkuPu0A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UrjfdEUi; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52961b77655so4152350e87.2 for ; Sun, 09 Jun 2024 12:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717961922; x=1718566722; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uFG9zs+TOxLu+QRcet0jDU4W7tv1prViIcV9q7WG5hg=; b=UrjfdEUiWBCSvVCN5M4KJDCoajoOhLLxz9sGfDAg29oPrmYhJ2Lk/bHKJli8T7OY1n vGT2w5UxRbdAu8ExqlCyzQGiDP44PK7EcPTaLhzJRAsXKOtSSZE512oCftPhr7CI8r0k SutGvmWl7s/W8dXv1M7ac4BhwB7ZZFedB1x7GYSWkVsEt4ezv5ImBqP/EOqpRGOJZ+hL 2s1bkYrk1IQqTCtzWvtMoTFgV85szm3LcA5QwUxAp0VQQJQZ3IEyinvKsRWVqHGeU5To xAUgYqY3VbUHaDomTaPzwtn2AuAKeO6RAO+VZ0YulyVSCEdLSQmnNiW1zAfzJUah7HKE D3Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717961922; x=1718566722; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uFG9zs+TOxLu+QRcet0jDU4W7tv1prViIcV9q7WG5hg=; b=bhTEOG/ZqwVjCo8srSoIPm7BERsll43gx73NehQQbB7zitmvljl3Q3/oHJnYVuHTCj u8m1OjmxEOk2YJZ2/Biq36dHj9PTtGBJse/6sBWjq9yy+dnQEFEziyHBcbgdqXQWX/ZR BgTtjfSapCJL8FaSUuCQYAo9kZ2VNYdT4+2vGttfEiXRfsvI0dVKrxPFk6/htwPYQwSU MHMw1rqnRkOKgO29nYjHsdFKfE7hvRp+TP+JcF9rdRI6YEkYFPcPmYAFasBX7eGFubKJ ydWQ5V+9cjUn3IEGY2v5AGov0FjHkeIjSFsNql8nJIguYAirZqIxBRSWKevPpLocUSg1 OP4A== X-Forwarded-Encrypted: i=1; AJvYcCUhUymeEAZHEiIqrxdcFB0GKHDimMUf9Rk5CzzMbNXuc1gixi9F74IDMhetts5hi9g+AgosMUfo0fDVhNu1S2NOF65706AOsrrmEneY X-Gm-Message-State: AOJu0YzFIQhsbhLrXbKsh0TxbA99AtDAW2s9vHOxYEEX+sH5EmAbhP2Z t14QhbxJclPtKblg+szEewwL/V4HQYNKvdpCbWIX++Q+Fyd89IL4Iwi0t5dzu7M= X-Received: by 2002:a05:6512:2211:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-52bbf8f01c6mr5065732e87.40.1717961921651; Sun, 09 Jun 2024 12:38:41 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzbgq2gvv5-kpclzt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a04:adb1:631c:fd0c:1269]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52bb41fa022sm1286759e87.118.2024.06.09.12.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 12:38:41 -0700 (PDT) Date: Sun, 9 Jun 2024 22:38:39 +0300 From: Dmitry Baryshkov To: Dan Carpenter Cc: Allen Chen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Hermes Wu , AngeloGioacchino Del Regno , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] drm/bridge: it6505: Fix potential NULL dereference Message-ID: References: <5e6e8882-478a-46c0-9119-b643d524cc0c@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e6e8882-478a-46c0-9119-b643d524cc0c@moroto.mountain> On Sat, Jun 08, 2024 at 05:21:08PM +0300, Dan Carpenter wrote: > Smatch complains correctly that the NULL checking isn't consistent: > > drivers/gpu/drm/bridge/ite-it6505.c:2583 it6505_poweron() > error: we previously assumed 'pdata->pwr18' could be null > (see line 2569) > > Add a NULL check to prevent a NULL dereference on the error path. > > Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") > Signed-off-by: Dan Carpenter > --- > drivers/gpu/drm/bridge/ite-it6505.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c > index 3f68c82888c2..4f01fadaec0f 100644 > --- a/drivers/gpu/drm/bridge/ite-it6505.c > +++ b/drivers/gpu/drm/bridge/ite-it6505.c > @@ -2580,7 +2580,8 @@ static int it6505_poweron(struct it6505 *it6505) > usleep_range(1000, 2000); > err = regulator_enable(pdata->ovdd); > if (err) { > - regulator_disable(pdata->pwr18); > + if (pdata->pwr18) > + regulator_disable(pdata->pwr18); Wait... I wat too quick to R-B it. The driver uses devm_regulator_get(), which always returns non-NULL result. So all `if (pdata->pwr18)` and `if (pdata->ovdd)` checks in the driver are useless. Could you please send a patch, removing them? > return err; > } > } > -- > 2.43.0 > -- With best wishes Dmitry