Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6029943iog; Thu, 23 Jun 2022 09:54:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uV5kkeRk6THmc7bJS082U0klXiLRXqFDJvahZSagAOwKn5rFTEHwaC6G+bdlPM0ZvU691h X-Received: by 2002:a05:6402:84c:b0:430:aae2:6dd8 with SMTP id b12-20020a056402084c00b00430aae26dd8mr12015979edz.31.1656003261810; Thu, 23 Jun 2022 09:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656003261; cv=none; d=google.com; s=arc-20160816; b=YqPuJwSjpn8BJyNYb6FsMNl4QWPd7jjxZ1Xx8U2K50FOapiie/kM3mhygDlx8VYbhD z/rqRSgtZsSv37kQaOdovMGEfTCYz9FsPnd6WqVttfCVPFoITKodz9JCdHFO0thwqmFJ 73FB6cUIAh25r1y3pRI3aC8AwmxpUlpGNhoWtAJ9iAicHhLpnBdBbIE8o8LuZ88miEBu rD2X4M7BdpHvNdPKKhWSJQ49wkDcii1m4nMT6+7Dasrr7iUq9Dh159b2KlfMLf8lAATq 7RinjAGE1vkATetlPQrPbs+9Ju7B8AdKPQyhVhfgx1rqK8opBzdUkEW+vpf7VFv0qnQc pH3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B1jvVdluJ66W41UOcamwBo/85mg4sSq7LE7oRZc9/Ws=; b=caaguMFx34hyv1L8KIWAHF0aXoHepmiPY3MK7usgFngtED0wJXuPP2GoM6oNT84qnm qUc5f0Q8aox5yPko6wUaXfcfM5y5p3avOI+4O0Yp/s3TEYzPuM1HUxxkr99jo78Z2hlp 2WVvvfSAHerQxB4/Zww81F+gzXHbqoxF/I1WS+Ty6qI3xfiCJp9iW9EPVn1zQ32Dnjkn S09uC+i2PfFn6OY4gnfbiMP0NwzwV6jkyBn2zo45XJkDlQkHH//iuhk8rFq/e/CpErab GbuE8GFDdonEYvsgkYE5APx/hi3W0kq0+lby7q3odItdSHZGLpqCikYyfB/KKOPxjJXF 1oDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=CQgpPxqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg20-20020a170907971400b0071200e56beasi22819723ejc.825.2022.06.23.09.53.54; Thu, 23 Jun 2022 09:54:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=CQgpPxqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232660AbiFWQr5 (ORCPT + 99 others); Thu, 23 Jun 2022 12:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbiFWQrB (ORCPT ); Thu, 23 Jun 2022 12:47:01 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A8D49CAE for ; Thu, 23 Jun 2022 09:46:58 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id cs6so188771qvb.6 for ; Thu, 23 Jun 2022 09:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B1jvVdluJ66W41UOcamwBo/85mg4sSq7LE7oRZc9/Ws=; b=CQgpPxqnnpqAloyO7Cx3oS7JP5gZQB3Qg0Mw2O4cWqw3cPSl/gs3pEoUgwTf3F2ERo dqIndkVy6qNbaczXA18ui/W1Uf2EYbUGkmckXM1NOGViyBpaCUtGPOXa2WE1WTX9e1SY WML0WjDpL/clGTLZdmKiq6o2tGLLrdlI9gHCS10Mi/kIkpec+p5IdmoZ1XFY7puK4uUH BOawN171/X8635YxQHiPx4XzloEvkwByWBIBZEK6EdI0XLNGOUpp6hZiKZvi2jJngvF0 B9azYvIFMbctnuc1A9kMbnzp+BAbHnl6yOUVoDpD9sY5t2AHKxM4D6ijomMyR/wV0j+M MQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B1jvVdluJ66W41UOcamwBo/85mg4sSq7LE7oRZc9/Ws=; b=oEdJzSxPcA7T8Kwl40lcfSh97BdTOe+//kevggijG3XBZYHIrTWJYD+eIqDMyKZABK LqOiOu6ML5qWrxJjDN8/c7SXrpRJwlaryR6J6BNa/fQR0A3vz0sb9nVutcooXKY2GWMq Pi454Xcw77lUfBCV+qzGcRPiKNLBxOncj2rYJCT5CzhTzxv67taoa/Kl10v6+UZEwkuJ W6i5Lj8XPdMyLTjg7MWC1vCjNkEWmJ4S6qKZ4eynQGR6jNAImKTHv7dq7MJUR+K+2UJC s+c62agKSngSVYXUfdXaTkOBajXSB0gL1IqJ5rofPanbQ0zx6go1OKggx2/y9EntOEpg QkSA== X-Gm-Message-State: AJIora+de/wzEertCpWIZnRUiCwoj3zCjH7g6LAB3z+FC7xiezPjFJMz S2Zo3JzhyjGFyiAxyx5Lm5t8JA== X-Received: by 2002:ac8:5a04:0:b0:304:f19e:5fe4 with SMTP id n4-20020ac85a04000000b00304f19e5fe4mr8951799qta.374.1656002817837; Thu, 23 Jun 2022 09:46:57 -0700 (PDT) Received: from localhost (115.25.199.35.bc.googleusercontent.com. [35.199.25.115]) by smtp.gmail.com with ESMTPSA id x28-20020ac8701c000000b00316022dcc08sm3157121qtm.11.2022.06.23.09.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 09:46:57 -0700 (PDT) Date: Thu, 23 Jun 2022 16:46:56 +0000 From: Sean Paul To: Brian Norris Cc: Daniel Vetter , David Airlie , Heiko =?iso-8859-1?Q?St=FCbner?= , Doug Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Sandy Huang , Sean Paul Subject: Re: [PATCH] drm/rockchip: vop: Don't crash for invalid duplicate_state() Message-ID: References: <20220617172623.1.I62db228170b1559ada60b8d3e1637e1688424926@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220617172623.1.I62db228170b1559ada60b8d3e1637e1688424926@changeid> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2022 at 05:26:52PM -0700, Brian Norris wrote: > It's possible for users to try to duplicate the CRTC state even when the > state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other > users of __drm_atomic_helper_crtc_duplicate_state()) already guard this > with a WARN_ON() instead of crashing, so let's do that here too. > > Signed-off-by: Brian Norris Thanks for this patch! Reviewed-by: Sean Paul > --- > > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index 74562d40f639..daf192881353 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -1570,6 +1570,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc) > { > struct rockchip_crtc_state *rockchip_state; > > + if (WARN_ON(!crtc->state)) > + return NULL; > + > rockchip_state = kzalloc(sizeof(*rockchip_state), GFP_KERNEL); > if (!rockchip_state) > return NULL; > -- > 2.36.1.476.g0c4daa206d-goog > -- Sean Paul, Software Engineer, Google / Chromium OS