Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1058938rdb; Tue, 19 Sep 2023 20:24:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzYnp5i3rGrXR21Js3hwHsbR0eshPTaxgp/ql1sgDSwTjZzcGwonwLKArJUkUN0q4PTjGR X-Received: by 2002:a17:90a:c0f:b0:267:c0cb:e462 with SMTP id 15-20020a17090a0c0f00b00267c0cbe462mr1292760pjs.48.1695180282941; Tue, 19 Sep 2023 20:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695180282; cv=none; d=google.com; s=arc-20160816; b=PUsKf1RSx3yO4T9pwaV1lbnetZCTLScAv4kleA36OVGpQevqxjna6S32lHL0C6Ueyn HKuzsa0q7E4OzQzhBf9CMJ0f6QdWLeRrtAOq+YBECd6aC3yYhWGgELfKcKrsMfpLQgA3 Y732/+EezQD+/o2+g8HsliYCtt3gIZ1cJks4+qw5y/dT7mJSXx6hBIz5q/YgwMjAZAM3 W+7VccfHLKg57mIKdCW8TKmTgIUUsD3NodW4onUP2ezpAzvWAm2Og0bV26DGN2nOcmF4 lvqylie0Q7+kKtKgBa79byDNqRDvPqGnfm/qLm7E7P1+SRRoNZUeDQY2HtB7//I6oeZ+ 1OgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KQLUYa3KKK3ZT24Fs/QQWKicsaIGPOdPCRwIWIKrD1s=; fh=fGCrOE0ITY1Df6W6i7tA1ZkHrTtbBtVBuPHpvZG3TWk=; b=twGEStQ0riOsKjJICLaNIbVSisUDYgDB79Gk0cytdymfD9ly/vcB7qAIuMHdzmJa/l KOvnCesJFhtiNT3Q39i+WxZt3ypkZlR+HELu9OclcC3EAhiX3k1zIAcVvBbqL2eot36O KCUxrIXr37rNhEqfffFmJGT4GDHDtLv53dUV0Kq8gN5Ad7sOaCuoQHtvb+4CJJgEVaLG lMSTJ/2QZvo6JXbv5iOpRywnowVbbnZyJgTK1T5nyAMwiAQEu953Xcl0SHhcoeWMpXY9 ZqJ/AAbhn4StvQiq02S78LjH4JyYmYPvR0SB3RmJNMbWXMu1klGgqtotvkW6A1rtB6aW mRVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=T1ufyU42; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l16-20020a17090ac59000b00274bdd908dasi596438pjt.97.2023.09.19.20.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 20:24:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=T1ufyU42; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 57F0C81B17FC; Tue, 19 Sep 2023 20:22:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231675AbjITDWc (ORCPT + 99 others); Tue, 19 Sep 2023 23:22:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjITDW3 (ORCPT ); Tue, 19 Sep 2023 23:22:29 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 908419F for ; Tue, 19 Sep 2023 20:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=KQLUY a3KKK3ZT24Fs/QQWKicsaIGPOdPCRwIWIKrD1s=; b=T1ufyU42gJYnYJshDrzsl o47D4KyptcT4WfcGzE/IdE/KGCCTOY+37mdOSBMk4jDC7r+VfU+jlJQ3YOVSWjIy UgBU9yX+qKp7YF9xym4Gf1nSmE5zyGlpSEZSMGAeW1MLBAFumXkJhmj/99KXiD5n FfQqqMa/1czgf0fT3+efmQ= Received: from icess-ProLiant-DL380-Gen10.. (unknown [183.174.60.14]) by zwqz-smtp-mta-g5-1 (Coremail) with SMTP id _____wCnKEdYZQplhLhFCg--.4484S4; Wed, 20 Sep 2023 11:22:07 +0800 (CST) From: Ma Ke To: alain.volmat@foss.st.com, airlied@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ma Ke Subject: [PATCH] drm/sti: avoid potential dereference of error pointers Date: Wed, 20 Sep 2023 11:21:59 +0800 Message-Id: <20230920032159.3542372-1-make_ruc2021@163.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wCnKEdYZQplhLhFCg--.4484S4 X-Coremail-Antispam: 1Uf129KBjvdXoWruFyUWw4rGr43ZFW7Jw13Arb_yoW3trg_G3 WUXr1fKrWDKa1jqF4jyrn8JasY9rZ5XF48Xr1Iqas8ur4kAry8X347Wr1fWFyUWF18tFyq qa1xur90krn0kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRMeHqJUUUUU== X-Originating-IP: [183.174.60.14] X-CM-SenderInfo: 5pdnvshuxfjiisr6il2tof0z/1tbivgDwC1ZciymIqgAAsP X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 20:22:33 -0700 (PDT) The return value of drm_atomic_get_crtc_state() needs to be checked. To avoid use of error pointer 'crtc_state' in case of the failure. Signed-off-by: Ma Ke --- drivers/gpu/drm/sti/sti_cursor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index db0a1eb53532..e460f5ba2d87 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -200,6 +200,8 @@ static int sti_cursor_atomic_check(struct drm_plane *drm_plane, return 0; crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); mode = &crtc_state->mode; dst_x = new_plane_state->crtc_x; dst_y = new_plane_state->crtc_y; -- 2.37.2