Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1822718lqe; Tue, 9 Apr 2024 00:59:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMlkZAF77bdw3ulWJu8D3uAgh03ow85AeyVomMU0sgSgIXxmoTY6PHVfu/mD6cGLe2Gt98tSikFZyWV/wZEQp8WwQk3S1w1BEeL1byUQ== X-Google-Smtp-Source: AGHT+IGS0672u3CstH10EqEud0TKifTwbnFEJkJ27OaUe2deD4+K6dr9SZqS7ViswSotkBFIWH19 X-Received: by 2002:a05:6808:17a2:b0:3c5:eebc:dad9 with SMTP id bg34-20020a05680817a200b003c5eebcdad9mr9214398oib.35.1712649594158; Tue, 09 Apr 2024 00:59:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712649594; cv=pass; d=google.com; s=arc-20160816; b=VYyOKXZqTPjqDUjIauJDp3LBITWsFv+3XCFsHmV4eDskxkT05TVgi/h1eT7VN7U+W5 LQF3uTIsNN7eE+P2R3CV2clcW6G31xDFHy5eeKPd0MkJIWkJQFoySkn5j6wvpYtFZUnJ UVyKi4omVFhxpRE85yhMnPIXM4PXOqzBFzEaVRfh69PiNsWPm70qZIDz5IyzLuvSQobl k6Ylym3msDrUmzBTbxIu4HrA2hhdXPTl0lGTcIADSDMEy9ZFL7gGYyGPOc4WLwgtHKaS 5difxr3Ohch7z5LTEYYzx94lmGagnrllyueuhal3a0nzBBlU/hroXMDn+KZHpZUZPWar 3Ysg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=19/Iy6O/3LiyHhHggC3Vu6d5yWOLTGboqwpYX5yUxhE=; fh=X0a6/GZvmOGxsBxl8029xduWs8SP8MXMz+7HwpRgAvQ=; b=UTJGyLn8mE66ygAuqyGbyqxgrtqsS5U/9UzSv0N2pWPhTXow8B9O9FTYiQY6QX9Mg3 xevLL7onMAPiu+LDOSQqXZ2Ray1o9LBTem+MOAQdCOJtI1BSq9vgRJqIlm7KI8use4zS YQznKLwq3LIgVX9qr+WfsDRU7rQfSuR49mYkLbml+OHoZ6E5Yy3z2Nw+ATEYq3K2hBGz UzgtD+hw5G/QHYosQqXsH+IW7smmYNZ0c4H++Aw/GS0rdxOTHPxlfJODh9+YM9ahmFXC 2bkVXjVCVwwi85NNylAV8JuSt2oHzMc9RltsmPnWaLJe0P5dsdSmQA9VhkYU0JaCw0jy HfgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=h2KMpMeG; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-136399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136399-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t42-20020a056a0013aa00b006ed14fed3a9si6104489pfg.218.2024.04.09.00.59.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 00:59:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=h2KMpMeG; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-136399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136399-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru 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 2A594B224AB for ; Tue, 9 Apr 2024 07:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B2EE7D401; Tue, 9 Apr 2024 07:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b="h2KMpMeG" Received: from mx1.t-argos.ru (mx1.t-argos.ru [109.73.34.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D57CA7D3EC for ; Tue, 9 Apr 2024 07:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.73.34.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712649497; cv=none; b=nIfUAcH/mtstA00lmxzIBE6FdUqhBeycucHUC49NOv9QyhyAPhdKIhFBdhmu8Jy8iiQ95T9vnnFQLyoXT8iJmcjcgr1VtGfEP/cO7aYrwJsaUXBGCrwcwVYrElY8oGOOLfJYGRrwR1rNn3+4TtEddBZj5jDwamZeib2yuJNpcZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712649497; c=relaxed/simple; bh=fkQFeV62PoatkDect11xNRrrL7rSiE+jiTOmwVolER4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=A9RF3eUTKyPfvTyjbZ7Dloq+t4kHbSOMyJdZRRy+8Lxw6QFpqLAQkG/QJhqaDk5kaXMcIfKQLpbtCGtDPnhqM8qfQ2uAp5+AIf78JNSyFY7xIwhKvolKTE9wrLJ4u4J8jge28MAIHjcTZg2V3k8xckCHoDdpDI1+LJPjs0RaCmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru; spf=pass smtp.mailfrom=t-argos.ru; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b=h2KMpMeG; arc=none smtp.client-ip=109.73.34.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-argos.ru Received: from mx1.t-argos.ru (localhost [127.0.0.1]) by mx1.t-argos.ru (Postfix) with ESMTP id ACE56100002; Tue, 9 Apr 2024 10:57:52 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-argos.ru; s=mail; t=1712649472; bh=19/Iy6O/3LiyHhHggC3Vu6d5yWOLTGboqwpYX5yUxhE=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=h2KMpMeGhSjBRau0u8dxlvcVd01vY+Bg0ZgvGrH0+UFqhE3oI/y6dv5nffZVPBFRR taGnfUqPJQD0v3Mg27F58CI/vKFRXut6pQrffVZ0rHYyMBSqxJu/eEu9WMVCoNiFBF vbhGbh4RfQ369y3AqyY/XSsnl/frty3BNVkmZwDUu9CJluZ8QAZJ7rXFM0Am//kQt+ yL3f18NadrMDRXadGUmDHbcw4OHH67HgGlKQm+zkDxbUxQRPvpSswgRhlb+lJ6NKcg GtgL+IrE5LkDOGY3J2MgOb8xTzb/Bqg2ITyQsidjMxn4edlPW9Z4hDYWUP57JoC4// kvr8ACzovQrNQ== Received: from mx1.t-argos.ru.ru (ta-mail-02.ta.t-argos.ru [172.17.13.212]) by mx1.t-argos.ru (Postfix) with ESMTP; Tue, 9 Apr 2024 10:56:50 +0300 (MSK) Received: from localhost.localdomain (172.17.215.6) by ta-mail-02 (172.17.13.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 9 Apr 2024 10:56:30 +0300 From: Aleksandr Mishin To: Eric Anholt CC: Aleksandr Mishin , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Boris Brezillon , , , Subject: [PATCH] drm: vc4: Fix possible null pointer dereference Date: Tue, 9 Apr 2024 10:56:22 +0300 Message-ID: <20240409075622.11783-1-amishin@t-argos.ru> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ta-mail-02.ta.t-argos.ru (172.17.13.212) To ta-mail-02 (172.17.13.212) X-KSMG-Rule-ID: 1 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 184634 [Apr 09 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: amishin@t-argos.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 15 0.3.15 adb41f89e2951eb37b279104a7abb8e79494a5e7, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;mx1.t-argos.ru.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;t-argos.ru:7.1.1, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2024/04/09 06:51:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2024/04/09 03:34:00 #24714050 X-KSMG-AntiVirus-Status: Clean, skipped In vc4_hdmi_audio_init() of_get_address() may return NULL which is later dereferenced. Fix this bug by adding NULL check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: bb7d78568814 ("drm/vc4: Add HDMI audio support") Signed-off-by: Aleksandr Mishin --- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index d8751ea20303..5f8d51b29370 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2740,6 +2740,8 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) index = 1; addr = of_get_address(dev->of_node, index, NULL, NULL); + if (!addr) + return -EINVAL; vc4_hdmi->audio.dma_data.addr = be32_to_cpup(addr) + mai_data->offset; vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -- 2.30.2