Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2263570iof; Wed, 8 Jun 2022 00:48:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjrvsIDgkHEH39r2LbKKsF19w3BIjQRMrLXIrSN2DXiaJNUmhs/On/4NYhI3gZUgrM7Rpw X-Received: by 2002:a05:6a00:1350:b0:51c:26d2:9ce5 with SMTP id k16-20020a056a00135000b0051c26d29ce5mr12403784pfu.69.1654674532961; Wed, 08 Jun 2022 00:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654674532; cv=none; d=google.com; s=arc-20160816; b=LXoHFA2nPq6TPvJnT0KLaEAJDv21PjMBJG5Gg+hB9WM7zU6QjOCe9qory4UMzuQT5j UFYZopiTOArk02MOT6WPxJ0Od1yI7SxGuCdVnKxlT3Dj781L72zAw0PkmnON6YB2cEvB wFZrIRt27rakG7lJDTM3D9+lrSRJMPNE8n6iKh25R5bpWUY8EZCmgD/6TtTXkqbN5AFR irg4cw42VTEaFlOxAW41LJuDIguqyAAm8tyGd9qpqnsmG3dl/NTfCJTMg5Bo8Tz6SeXz iKdW4v3YcClvakKoIVEjSWNpdhI7JfetAkXfj6iDj7mHYei38orkq0/zpBDSJXg17C0c vXrg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aQUuZEJaQXA1MQfzSPIhbzimuCdLV+p00yyOAP4vVsQ=; b=o+e85cQlwaZvt2lSXKVVTsZ1ZAJgXWiUjl1UoKTl1ASXtHu4ypkk47jJZbB0RA7eOo jAXnrqn8ctzRGA/uz2E1BPj9UlMdNbHKl2ma+Ee/reuTrMv7oacKwZq3rKUoZR2Wdt3n O0lcYPK/L2uk7Tt6pkmXCfoIhHsyWmk8ycWV0aV+dQV2V2KtgZZ6W5F9g6fZY5GuuSzl 2tr+OOoZudFAc0C/+wHIjz/ubgoWKm5M76IQ2bH4upRLcfR4hzqE8HU7XtBOPS3/ogs2 wkUZEtN8+KykC3ntI7APbsNIVwLxPeDmdE88HRWck01QdwHN5eV16W0FQJxCaijKELRN Su+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rnDmqBTj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id jh20-20020a170903329400b00163e4495597si2772140plb.581.2022.06.08.00.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rnDmqBTj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1888C12815A; Wed, 8 Jun 2022 00:18:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380694AbiFGW1r (ORCPT + 99 others); Tue, 7 Jun 2022 18:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378026AbiFGVSt (ORCPT ); Tue, 7 Jun 2022 17:18:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F71224129; Tue, 7 Jun 2022 11:59:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A840AB823A0; Tue, 7 Jun 2022 18:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1017CC385A2; Tue, 7 Jun 2022 18:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628363; bh=/dbWxOZHy2OewWmHqoNlkYSibashwQ7otUvCVbYc+WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rnDmqBTjkWyJ7A05dYm65uV3/YN2F+U2yqroMMltT5DP3RfJ80yDuVkABrrHJyXtR TkrkWp9Nc7soyQOHoqNqzJWa/31GWKKS8SwilGJXwTBe+fZyVyqVFWDvcgY6lAPz0+ WHXNuIrrRoDM1+8VVO/2U7G9gxZXWpaQdXPgUcpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Brian Starkey , Liviu Dudau , Sasha Levin Subject: [PATCH 5.18 302/879] drm: mali-dp: potential dereference of null pointer Date: Tue, 7 Jun 2022 18:57:00 +0200 Message-Id: <20220607165011.614906035@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Jiasheng Jiang [ Upstream commit 73c3ed7495c67b8fbdc31cf58e6ca8757df31a33 ] The return value of kzalloc() needs to be checked. To avoid use of null pointer '&state->base' in case of the failure of alloc. Fixes: 99665d072183 ("drm: mali-dp: add malidp_crtc_state struct") Signed-off-by: Jiasheng Jiang Reviewed-by: Brian Starkey Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20211214100837.46912-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/malidp_crtc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 494075ddbef6..b5928b52e279 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -487,7 +487,10 @@ static void malidp_crtc_reset(struct drm_crtc *crtc) if (crtc->state) malidp_crtc_destroy_state(crtc, crtc->state); - __drm_atomic_helper_crtc_reset(crtc, &state->base); + if (state) + __drm_atomic_helper_crtc_reset(crtc, &state->base); + else + __drm_atomic_helper_crtc_reset(crtc, NULL); } static int malidp_crtc_enable_vblank(struct drm_crtc *crtc) -- 2.35.1