Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp16135rdh; Tue, 13 Feb 2024 08:07:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWcl0E1OezaFoiqDP7JUhTOTaTtxyHO7MUhlfVe4Rei7Aq5YGJssySXU6KLfC4fFIslDCl9mIerG2ljz6AZcvJiuiRLa4x/3Axrq7hYmw== X-Google-Smtp-Source: AGHT+IE25R8VANTmwwudYLR/STdcNGse/D17DmTgIaowV1T4roU9K+3sZeS82TtTioWkH55dJJXb X-Received: by 2002:a17:902:c213:b0:1db:4419:e925 with SMTP id 19-20020a170902c21300b001db4419e925mr1251901pll.1.1707840455471; Tue, 13 Feb 2024 08:07:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707840455; cv=pass; d=google.com; s=arc-20160816; b=o6wGaJIuJco5YvShTlfEf/HES5O1aYXGBE4JTHZIEQshNUhKNXNF/AAWGYHagSzXYA /W+CZolsZ7QrkBuaGQKdoVSKP0CL/KsTBCOGNNwimpG7PRtEdEghl3j798aMS91ZZ/Gg vxN1wAMTY1g6JiYlXqjPNml6SPig6rRfRTis6DgiF+6Fl51IEe9UPciY4aOfewejoy46 D/EjtHeUNM2AMliPqIA2Lgr4mygPnac5VczEPAdMs3kt5AHOr05+R8Lw0PTawEeYPwYn MEqh2+WdMrIEJmvRaeltJPq7blBEjGVQJnMjcMel9BzqA5Dx0YIx8WLOp1Uq//zymXK3 8GvQ== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=zVqR/5/foYJq4j/fGiXL03ER0xcO4xMj29CysqUTjro=; fh=21LdXq15pOcapkQXdLFhZ2pDdY9bKylhGowfK4VyKpw=; b=IlHM1G0sLgWL83tSHjt3GO9knq+X2KKctJO2OcxtsSG+3Xn94CUI5eGtqMR1o2UsMI kqtNBwccjZdHAxe/4Baonky8NgczVfUR1EWJiS0iAOfburZgn0yCg4N90dhzZrkex7sr JNbIcedSOAvkY4H0pyxzk5d70lVr/nkA2DpRwpx9G6UKqeYLEB9bq0oHqsvv7OiVvP/F 3RSoAgcxIEUtGWCiaFotvGwRGNs5IOdTqFLCz6N8iLmyo1B7VZwPy1xibSO7SDBSqtzh OFCRqfmIeFK/Rwiovo2Bfp9kI0PBAYIK2nVArBeB4Onpn8AgipaRDso017Nu758ctp+1 xdvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=VroHhq1E; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-63627-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63627-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXwRqnczwuTRmRysM11rjIT7izDyCi7ixvCuDLd60hznPZomBXm+xxgFLJLVLfF84Oe4GK1B4J5zlEhISHV0pc3+od1hZ+q9v4ElhO92g== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s3-20020a170902ea0300b001d990844e53si2285276plg.437.2024.02.13.08.07.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 08:07:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63627-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=@ffwll.ch header.s=google header.b=VroHhq1E; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-63627-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63627-linux.lists.archive=gmail.com@vger.kernel.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 B29F8B21415 for ; Tue, 13 Feb 2024 13:59:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5622C57322; Tue, 13 Feb 2024 13:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="VroHhq1E" Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 F288057303 for ; Tue, 13 Feb 2024 13:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707832785; cv=none; b=GQal5lyLoNNPMbxqzWJ9sTefyLss/KTET59amfDvZ96Gg+w5ynuSxBocDZftebmBlKikB32pmGVu7QRaAxigsg/+n8rivG+eotDRIJVdt6kO1aBHj77VnEPT2rZpzfLOER/oxFejTX/areUUhCfSnBohvzYuOVtLBol/ReHGxDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707832785; c=relaxed/simple; bh=Gqe8/L6NiHs3Rw9Awbp7gjuDOiSqOn4agyfE1DfIHBQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NFhDnEWoFIF3XBvPFEnZEXtNkj1aeGE9pA8i78oYnoZyKdmCynXbBvp5CohlM+LTcR/i0v5xXyETfgXUOrlr5WU9vaYzdVUY1zVnHX2nvkbIzPzLncpuiMcjjaz9MqF4AdoJMZaeBOmsE3xApVU4G9TjgRNiaPkJpJn5bA7LRBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=VroHhq1E; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2d0cc05abd3so19169641fa.0 for ; Tue, 13 Feb 2024 05:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1707832780; x=1708437580; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=zVqR/5/foYJq4j/fGiXL03ER0xcO4xMj29CysqUTjro=; b=VroHhq1EHia4dUSCoU4YHLqejGE/3yxlCZxKs+WMW91diXhR/GJrprCqAELnSGZ/eY UCQiDoI7LNvL8c/NVYYypVp4oxwoP7pScvVLe9jKg2Cnu43mt/lGTgQK2BnxwDCYB/C1 sCcrW9UP2rmt0TdjdVAM1gAeeMRjfUCCrRR8E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707832780; x=1708437580; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zVqR/5/foYJq4j/fGiXL03ER0xcO4xMj29CysqUTjro=; b=nVyTUAUrVu0uFTtp6gbnhGb3cS+5+vD8FgVmWNVaqJXaIINXRfZEXln+29n4Tr4O7F mQrqZevm+jZBY9SzYxYx18nsDZaWRzWRNgj7duTVKOHQiOOYRc+SOG36UgzVYb0/4i6e O4Y4GUf98JuRGhEh3+g5iC2u5nAnDulnJMxFhYTmG5RrVjFpV/myOKTBDfpx6w0ve0p+ 3G9+Q36c2XGwiP7F7xZYPYuzZwWylqotyEyAInh0c6SoqdiRdUU6tV+B4lpF2RmzuU88 ydK4jpTKkbJC0SJWZGtZstgzHvYVkorZ+eJUJY+N4w4c2BExktEDLjCM6iidBrAlIKUD dHjQ== X-Forwarded-Encrypted: i=1; AJvYcCVAg2lcYYW5AllD2LDLywxZk+x1/eM1YzgfPShJ0v+rXXBAuldQGt9bVF/fjxKnXtCOak8YKmJ3DM+S+tpr2hjXJIfrsYLI+855DM4l X-Gm-Message-State: AOJu0Yz6tI0YI8TaaghQISPB2o0G8bJXiXuCFlTvTRk8w+2sKdp3QexQ /AYUsBd00FzC08VIjkKssV3iIf3YSxVW+2HmTYKLc6352PO7x5gfdIzlWwzaujB5Tgf7x5qwUu4 o X-Received: by 2002:a2e:9857:0:b0:2d0:e09c:ceeb with SMTP id e23-20020a2e9857000000b002d0e09cceebmr5434388ljj.1.1707832780393; Tue, 13 Feb 2024 05:59:40 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUD/SnKrHxBKm2H7JmahlZvlDCwCIMIDzmiLIhrzzP9DfXJujL0RXWR3Fa7qqgk+Ow1O5nDoCqkvj2eAwhtnx4ksUw4qqBdH6F+UXUivRoC7roxl6NWugZ+pQPzSG9coQDpLC3t3jNnj0iz1JjcPBapR6aMoVhv9THGJLryZgVWGS8DLKpb1tWVTXq7Pp+JKnS9mc3nbDCqXOPoPKnk2r1eHrwL5iettL2/gujR4emCeaPUdV68PJN4dI3YFzHhL/CPgAiYNJIWDHt/qlnlFrMe9WultOXZ3GgehbYWtxmuGTe9ztE7NNxzJ1vT Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b2-20020a5d5502000000b0033b278cf5fesm9570780wrv.102.2024.02.13.05.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 05:59:39 -0800 (PST) Date: Tue, 13 Feb 2024 14:59:37 +0100 From: Daniel Vetter 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 Subject: Re: [PATCH] drm/crtc: fix uninitialized variable use even harder Message-ID: Mail-Followup-To: Rob Clark , dri-devel@lists.freedesktop.org, Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jani Nikula , open list References: <20240212215534.190682-1-robdclark@gmail.com> 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: <20240212215534.190682-1-robdclark@gmail.com> X-Operating-System: Linux phenom 6.6.11-amd64 On Mon, Feb 12, 2024 at 01:55:34PM -0800, 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 Cc: stable@vger.kernel.org I guess at least ... > --- > 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. Alternative would be a very magic for {} macro, but those tend to get easily defeated with goto/break and friends. Maybe it works now that linux/cleanup.h has landed, but I'm not sure it's actually better and not just trading one set of sharp edges for another. Worth a shot in a prototype at least, if someone's bored. > > 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; I think it'd be neater to have all these right below the DRM_MODESET_LOCK_A_BEGIN instead of duplicated here and at the beginning of the function. But it's a bit a bikeshed and in some cases (when you use it later on) gcc might get pissed too. So either way: Reviewed-by: Daniel Vetter Cheers, Sima > > DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); > > -- > 2.43.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch