Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3056419rdb; Tue, 13 Feb 2024 05:51:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHf42t/JJaJr4i4QWjerS2Hb00U4NFIUe4Ac9j4Li7UpAQYBI+97828WJsg3Bt2eQXDQCh+hw+ULEfsf5cL1hyPYgt4no+SC7EATTRUw== X-Google-Smtp-Source: AGHT+IGwGkwxBDGXpzNQ8xzQ3JH7J4jUTxdOmudwRI5ZKcsQ66127qy6/B3MfSwLJoWgbs550Q8m X-Received: by 2002:a17:906:470e:b0:a3c:7b82:187f with SMTP id y14-20020a170906470e00b00a3c7b82187fmr4851335ejq.20.1707832265843; Tue, 13 Feb 2024 05:51:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707832265; cv=pass; d=google.com; s=arc-20160816; b=d3jZrEStlDMgFWkPUkJ4dXJyM2P00i3fqbGW++07EnhdLGM9P38IYQ64apIpUyLKiz oShOWNK3HjTN4EPraBtV1ibypBr6yHlkJUZCyraxK8nGOvE6iVbg/eMujmIaxM/ipU2j HUQw8RKT5sypc9ODebyfElXKuIxxfPaeP2QrBZWdDv46gxRDl3sE/9RWZeo8iOhRj8B4 dJW88cP2Hkh4Zjae2dSoBswQY7YEWEcC0yQByarcR6nadFXkv8jRfV9DdyD2A0+/kj6s 5QS2DZOs06OtSlVFGcqd9AhN079yWwpnSzN5RZjdJ5J4265vLAvion/x2cozJNR62hNc 1swA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=EJDZaN3+N6WSLw4IYEvxsp0tQKnp1DRHMOiyVaOY74w=; fh=62NNAt4mI9UgLDgeucQXj137OHZIBeAOxXBlkwWJBNE=; b=YDr6KLv6TMMxiO6yWCOp5XxeaAfvMh2ykaNclWZtXGF1hpk8ys73bKCpsz7QzrgqG5 5q0xDLydKzAg+zNp8os9ekd1mi/qgIIJyT5lcBJ7MD6FAes0NEq2TsmktQvjlgZuoWsL gxXCUjVGadZ7ooks9caoL/AnWNIJyNEVvXg/J82LZIIVbRFYwuPLEaFWIiTFXcX9lUZ7 3KlFWCEww4xHJW7ghh1wZMojbOAMtvsvecFJ0n0RSmOXd1ThA6sYCqkwJm+AyABiuhvi HrVIozmu1LZwfcEongCv7lWZjgTqAgad/Y8lYWOhNq3kcfZGXQDONBaFw/orA/AEk34n c5Ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsdzPRbb; 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-63614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCUPMkzjaZnyNVgFTgjNnJOZpa/5PAnSzu4RtyNNFqF1RYuW9+UhQ6xa3weptrkvowMzBmNlw6gahd1pAqCWeYYoyVZ+wdvo5ZJJvCNaTw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d24-20020a170906371800b00a3c23815448si1259376ejc.521.2024.02.13.05.51.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 05:51:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsdzPRbb; 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-63614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63614-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 95F151F2145C for ; Tue, 13 Feb 2024 13:51:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79E1A57315; Tue, 13 Feb 2024 13:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KsdzPRbb" Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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 0CA7457300 for ; Tue, 13 Feb 2024 13:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707832252; cv=none; b=NDoEBeu6GiA84sAlShbxClBWqSjCk07L+PEXUEQcyY75YD/mgaNCnrinBwhIyFBO1R3uVasz9eCf/I7jEKwa3jUj3M36ruuogU4tvaR2wVayFB70p0nvK6hhfhPDb77Qmq6RZRHLHDckrK1lSWWnW1yQRCoM6Ft0beQzpN/Mivw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707832252; c=relaxed/simple; bh=H4d6QiW+KpjBQZm2ut/bIJWaNIg+UBqfjjJNfS+sVhQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=G5t4ImWjz6jDkHS3VI4VzOSfDFp5j/1I/YcCOpGziHYtDes2f2PYb7deZn3TJhR9JBxyplvH00KZdFZ1PuqtJv3e0j1tE/e9SSxA5+MZKhp/XoxsC2rfaXDxXmx4Rmfuc5n0CN2YtR7S40b7aRrnf+G3G5ks8tc06jJVh1tJjd8= 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=KsdzPRbb; arc=none smtp.client-ip=209.85.219.173 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-yb1-f173.google.com with SMTP id 3f1490d57ef6-d9b9adaf291so3114499276.1 for ; Tue, 13 Feb 2024 05:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707832250; x=1708437050; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EJDZaN3+N6WSLw4IYEvxsp0tQKnp1DRHMOiyVaOY74w=; b=KsdzPRbbAq/nAnEYZ/+A3Lm+8sNfNPqcCgWfTrlB8D7TZrKEA+90Xk+PYTgz/B2Pb3 CXb0mNFOsB1HOu2VzBqbTuSknbDSPtHG+o+bMoK1UfHmDObf/qja5orWk2ORdk165raX tt9X712cCYsLsp9uBdUyD3uXz8O58mPHliJHFWqKPAy2/e8L3it2J7zryaj9QmRWoJpj Atm7ZQ9QL0rz7NfAmakaqFBzh2IXLJnNBAAOvm7/jqgRtXJwZDxh9YG4jx7xz2YusKLw lq58CDJpciTGiOHr/geh6p9sp1OCKYeO9TEkOusliqeJ6alkv/7FhmO1RXJU13oqDuc9 cQew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707832250; x=1708437050; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EJDZaN3+N6WSLw4IYEvxsp0tQKnp1DRHMOiyVaOY74w=; b=pOXjP7ClwCnWypUS/KbLOT7dQTWH55nUV4CRN84Y4bfi7CNg28e946ufxwK+ZEYoc3 NQf90SIfVF3HorT4R/9iJ8OGHA3fZL5mel2OMIm27Lub7lP/R73tGWDqrQsI1BHeSlQS J/ezl5HpihYy8biQp62yE88YSdwq+02FKCyiDuvbM/ziPh9O/acbh3k9ID6ChabcxJBQ IyzgbBBnfEtQcHZ6YzFlZ7/sfXzbaNItTLrFhYULjJ8kwyGL0lT05OVAmh411/iHsehg iXHSqHPIvmnrzhde3UHDIU8kSWYECmq5Eli1Kwgpi2ftfhu10Ttdii1NrkB0uAYBcBwx b8Xw== X-Forwarded-Encrypted: i=1; AJvYcCX50kWFgttisBWDN0KpMJSA8objGMCybsI+x/mnzsZsoBZcd7L613kcpxOph198Te0a2kyMgvpcA5b3pNxrGP3BufKN6hTsLwHyU3Mm X-Gm-Message-State: AOJu0YxEjenCkUwgGYbD1NrWPdZQlk7nLphFhjtOCPya8ar5/ONpLGs2 aY3VWu8a/o5hsHrPP3cIZhT4+qlpeW4nXc668asL3/thXrwhOZaP7hS2T8O23LfZUznAdz8+OHG 5zhc4oSjOaAuxhCKcb5dvxkhmAykZ+xvl7XBikA== X-Received: by 2002:a25:dbc8:0:b0:dcc:a58:63d9 with SMTP id g191-20020a25dbc8000000b00dcc0a5863d9mr2949330ybf.44.1707832249951; Tue, 13 Feb 2024 05:50:49 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212215534.190682-1-robdclark@gmail.com> In-Reply-To: <20240212215534.190682-1-robdclark@gmail.com> From: Dmitry Baryshkov Date: Tue, 13 Feb 2024 15:50:38 +0200 Message-ID: Subject: Re: [PATCH] drm/crtc: fix uninitialized variable use even harder To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , open list Content-Type: text/plain; charset="UTF-8" On Mon, 12 Feb 2024 at 23:55, Rob Clark wrote: > > From: Rob Clark > > DRM_MODESET_LOCK_ALL_BEGIN() has a hidden trap-door (aka retry loop), > which means we can't rely too much on variable initializers. > > Fixes: 6e455f5dcdd1 ("drm/crtc: fix uninitialized variable use") > Signed-off-by: Rob Clark > --- > I have mixed feelings about DRM_MODESET_LOCK_ALL_BEGIN() (and friends) > magic. On one hand it simplifies the deadlock/back dance. OTOH it > conceals a nasty sharp edge. Maybe it is better to have the complicated > restart path a bit more explicit, like it was originally. > > drivers/gpu/drm/drm_crtc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index cb90e70d85e8..65f9f66933bb 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -904,6 +904,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, > connector_set = NULL; > fb = NULL; > mode = NULL; > + num_connectors = 0; Nit: I think we should move all this next to the DRM_MODESET_LOCK_ALL_BEGIN() and drop initialisation from the prologue of the function, but it's definitely a separate and more intrusive story. Reviewed-by: Dmitry Baryshkov > DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); -- With best wishes Dmitry