From nobody Sun Feb 8 21:11:35 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1CBFC77B73 for ; Wed, 31 May 2023 07:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbjEaH3h (ORCPT ); Wed, 31 May 2023 03:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234659AbjEaH3Y (ORCPT ); Wed, 31 May 2023 03:29:24 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 065D013E for ; Wed, 31 May 2023 00:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1685518156; x=1717054156; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OFS01oMh3vyVox4i27eCh4n3gvVM54Ok/qp21x0hPuA=; b=EhePIZmHRDbJblEx7lhEOYUBdGj8wPsZtnMzWawZ6SQ0lfUmlAPJ8vSH 2sAO3WoinDr5Ufnj3kUpodQknQaPjbod6tt3pb8I+R2MmZmDW5ehIZdm7 cQAG95VrWqaIPrFsxmwjlW7qhWK1HCk8n/RWyG63O6BZpYrF6Z+3hDZI7 t2HOhbW8rK0DujGE2J7mUVPBtN/k1JPmThIgFrvsa7M2YttDUBN1O6X5e q9/OHhDgdlL0hfh/FQlv3icnWYn7sDE6q49wHsZfAqLuMostnOQjNzGxL +6FYg+EZIlBqCZ1lSHA8QTMVpmCK6UtM/8vK48hMT8EUZYrda7F1TtSNq w==; X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="227735487" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 31 May 2023 00:29:16 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 31 May 2023 00:29:16 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Wed, 31 May 2023 00:29:10 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH] drm/stm: ltdc: check memory returned by devm_kzalloc() Date: Wed, 31 May 2023 10:28:54 +0300 Message-ID: <20230531072854.142629-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" devm_kzalloc() can fail and return NULL pointer. Check its return status. Identified with Coccinelle (kmerr.cocci script). Fixes: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats") Signed-off-by: Claudiu Beznea Acked-by: Raphael Gallais-Pou --- Hi, This has been addressed using kmerr.cocci script proposed for update at [1]. Thank you, Claudiu Beznea [1] https://lore.kernel.org/all/20230530074044.1603426-1-claudiu.beznea@mic= rochip.com/ drivers/gpu/drm/stm/ltdc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 03c6becda795..9f3ac54d4cb3 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1579,6 +1579,8 @@ static struct drm_plane *ltdc_plane_create(struct drm= _device *ddev, ARRAY_SIZE(ltdc_drm_fmt_ycbcr_sp) + ARRAY_SIZE(ltdc_drm_fmt_ycbcr_fp)) * sizeof(*formats), GFP_KERNEL); + if (!formats) + return NULL; =20 for (i =3D 0; i < ldev->caps.pix_fmt_nb; i++) { drm_fmt =3D ldev->caps.pix_fmt_drm[i]; --=20 2.34.1