Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp13390lqp; Sun, 9 Jun 2024 13:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV89c0ycE6vmR2jmyC5IffUht6VF47clVyhMNXD9SAzaKV2VZYOtcrF3UCk+rWeqQommgkLgbRVuIe8SFPY/ar9MJuIT0D1LHZ8zTr9Xw== X-Google-Smtp-Source: AGHT+IEXai9ZZGt51+7hmMRsoaCLQHqSU4k3FENEPYlpmFHiWRH9VL+p05zTOM/s1DP0mK7sZw3O X-Received: by 2002:a50:9357:0:b0:57c:6efa:8381 with SMTP id 4fb4d7f45d1cf-57c6efa8589mr2108200a12.42.1717966759218; Sun, 09 Jun 2024 13:59:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717966759; cv=pass; d=google.com; s=arc-20160816; b=JdHYsQ1Wg+b/n9I0egLCUTP0vJJNmUmsx/pLX0RL6QOSCRqOJAYHYQfmItPk9pFCjd qaGi6Nwh0X5pYJxyP3SgNENezBrMWUgKzzNxL7TtYQyRwoMwQ5eIyCd0upNBPTmRuGES KRchERN1Hfzm46Nwf4DhdYZb4j8C69dLDDhlkqp8MsEtnqzkTaN8+f7YSTSZ8QShq2xh OZZO1fcWheJy5/aiOFZlWqqE/DQnYSR4Mc0MRdh+gg+YqbCGQejjlg4mWxfDDKl5zJ2D oHPhNZi9yJUFgWaYlI8PpbrzemHbbJs5eG6tqitjUkJBCl/QBdgGJWoUpePO0RFxdQVN 14aQ== 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=S/4EBuqn92sFzanqVMeYwTClL1PJfXX0U+C7af6lxxE=; fh=vyl12en7w8FnsBIHSKdBqeI9pe+N67eyuncmYu2IWZU=; b=H4rgpLKttFx0810taqHIdtt5RG8pqUPozhd43yRorORzIr1s0ppqQL3wrt9WJ+/Btv RnfpPtX0G6PdkjeNPcjtpjfd4vq0/RvzqDF0oL1DZeSjvXTbWcS1pMHRqMvJxU2fiCbB U05ihwSB7KfJ+VIzfbCHiKMu0y9hCHxVkv9wTTrV6R7HcvyfDj3yu5MYOLoen0KEvued 1o/JOiCTezdXsKjchXoiML/HrFWpPDHIrZ/zW0loOC2WfrTrVWX2Dj0PwWkU/uv4z3bU UfsPCwqTy3NdTXqtHstfarjt4pwZ+WVU5gLXFnCgfmpeI7CIM90joIHwO/kZyYw1a52S ltGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lhLw7vfo; 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-207508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c60b27d44si2451869a12.497.2024.06.09.13.59.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 13:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lhLw7vfo; 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-207508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207508-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E5F291F213D8 for ; Sun, 9 Jun 2024 20:59:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5C154DA09; Sun, 9 Jun 2024 20:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lhLw7vfo" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 3087117BB5 for ; Sun, 9 Jun 2024 20:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717966747; cv=none; b=YNhHdYN1h9dd+y6jPfRo76nCrqs+OTW6Wpc1vdqiDJRxpfENUL8bkjaJut/LQE/t8F1sGxGG2zPYgH1EzLsDgzB2DDznnWZNkYbH6HKcRqKHzStJhCAodxKBeqJIozrntQI+5yn3xiJ2vtSAMANjjZeFOb4tDxqOb2LX7/hSNdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717966747; c=relaxed/simple; bh=7j1v+9e9Niga/uAleJmKC8ouLVwD561QrPfRenVGGhU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JDn1OKIjbSfwuxU7Ft7pa03zxI4mB7+ukiW8vqe5cBEeqnbNujWRCeRCACaN3nS/1sIBYiw05MbLDeH/ebzX0b0kar/mSLjJNyloT5qDOsvjrhER7a82Li7ANG6t9ggqc7L0uIZI+qTSsyWo5maRXvFWGUjeTrunjwlSyVJA9Ug= 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=lhLw7vfo; arc=none smtp.client-ip=209.85.128.54 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-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42172ed3487so15623365e9.0 for ; Sun, 09 Jun 2024 13:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717966744; x=1718571544; 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=S/4EBuqn92sFzanqVMeYwTClL1PJfXX0U+C7af6lxxE=; b=lhLw7vfofOYQ39xo6a6jGU0S+Bogg3cUW5Fwc0PfadUxIqtY1KDpVkigPq+KPEu9YS mF3T7uufRS2qyE4drIW68dG2ZzevQZ+5Hr3SYvOKBrYjuuRbFbKgnWLuGnSLLKreCa4X w+3b1J63D1DihjQHDPC/XzDCjonbie43adSfSCbNRqswg61I2350EkRaguGobu7+S0T7 2N3k4u8J75vZLZiIRSiFymXA0cSMfhnzCo95CYYwhUCh9yO9owChA8sUvoqKEhF/7TdX UiWTIBNYlQ1bXLu6+RmRxZn7SR0o9+YIqER9vxx75czvaRAyd9UqplkSue2uYazeU7/R n37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717966744; x=1718571544; 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=S/4EBuqn92sFzanqVMeYwTClL1PJfXX0U+C7af6lxxE=; b=VC04ETWRjEg7Rs50iOgeSg0+2RsU5qpg3O3xqunEfpULpXiIVljWGui5h9fgjV/tb5 keypVD2FjdlBpiF6E0HJzMfOd2QRIhm+Pdkfqx5srpnNG3AgXOQsl5RM/J1RIcf6cS2Z 77jP7iQo+S+o+hWZpw89tPO1VpfajXcaitmHXqu3BcI373TJ5cehFWL4oJEp59tSLPK7 vWKCT1XzEmKSdu8pY64+V0VGNK4fJek7jp6Vx+HxCtS12BRfuY78AHtFnO3Q0gKCf5Sp +/7BtJZOYyyGz+Tde1bEGcKHcCjkxCFBFib1NC6932g9xptf/goKfbyBGw0XWzpAUAYb C9OQ== X-Forwarded-Encrypted: i=1; AJvYcCWocuRFsvvK5RzGU5569zbwxcJP4aw9WUhH4htHWcpSVPQsUo93PWbyUUsQM86UDTjZgleR19FEqF7u89EX00UV1hboVozLNBTAEesc X-Gm-Message-State: AOJu0YyizzUojU5ypcImpHEFsrj9IVttHU7rPWDV1RwHTYckXoalirLu ds0abbXzGzyU6cPQ+N7fjUvetpTxlR1chhRB14w04ea9XyyLb5GDW1RcwmDNkKU= X-Received: by 2002:a05:600c:35c8:b0:421:819c:5d84 with SMTP id 5b1f17b1804b1-421819c5f0bmr19950585e9.10.1717966744343; Sun, 09 Jun 2024 13:59:04 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d6985csm9336089f8f.60.2024.06.09.13.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 13:59:03 -0700 (PDT) Date: Sun, 9 Jun 2024 23:59:00 +0300 From: Dan Carpenter To: Dmitry Baryshkov 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: <85dd2c45-df99-4270-abeb-a3633afb9d6a@moroto.mountain> 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: On Sun, Jun 09, 2024 at 10:38:39PM +0300, Dmitry Baryshkov wrote: > 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? > Sure. Will do. regards, dan carpenter