Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4457943pxt; Wed, 11 Aug 2021 06:35:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtQxlKUKTlr5pbRhUoAveFvuayX/oRkjkhLkFcAzaia8iN9KD5aFl8Q2gar6FR/CfOUN1a X-Received: by 2002:a05:6402:1648:: with SMTP id s8mr11134226edx.214.1628688919053; Wed, 11 Aug 2021 06:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628688919; cv=none; d=google.com; s=arc-20160816; b=r0RUmaBTH8xsKFtX7xkPRVNmLOzRyQtkvPzWVnwoSgMp2X7P1WmZjRLMl9+cGvkEih HAJOiGbkUIwB6Ee/EGqBz54H/NNWpdnUU7QOQG/JovwGZ0Trr3XJGSRPgUHsmsw3JVfK 9/rXyN8nInEG8SErn0cpXc2HkBSNUgWivP1z4yntLI9yFZ9pWDuIIxNlUWxtdkwpt3OU Yhi69Q7yEuffxZi37VOZpBMg765Hu/jjdMOtN/E488RCpMGdmMju/D4KpZ5ALhVQBL/M KVqH8LMuUkUclD/5XsI2Rg9GMBwCCdF4Cg4weuUsmUjYPgO2HhCShjndjNY15Lr1JYkd oipg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=B9edh7oaop7j14/ECIG06PU81IzupJx2d7NrDIjkstc=; b=gmSk02LlGC3IQ9R2OpNTVFcHYM5mwwD6jVSmoNR3oYCivmPVPCCoWaB4I6J3jtAT2R dhSo2sJQyl4KL/sYQbgsQ66/Imb8aAh/I9zlpGbBz7ebuIJLQpOVIcMCJyFuOUQ3eMww /mJyYa3mvazNBjJcxZXZ3aEHI9nVdMRXuBHGoZjH1ufeQl6wBYRPjz9gMFLE42zoaZx2 iFMksGt2tE2cB0xGSHVmRjgif26ctm2+uxa2kM1pfakZg2apITaa1SM5idT154ia0Dy+ gmPsZ+pOZI6HAvN6qqgJkALBYF91LFRPat+6Bt370Z4gfWjaVuZ+41WKz/KpNvQ/s4d3 qNdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si4741346ejj.614.2021.08.11.06.34.54; Wed, 11 Aug 2021 06:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231575AbhHKNc5 (ORCPT + 99 others); Wed, 11 Aug 2021 09:32:57 -0400 Received: from mail.ispras.ru ([83.149.199.84]:38294 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231479AbhHKNc4 (ORCPT ); Wed, 11 Aug 2021 09:32:56 -0400 Received: from kleverstation.intra.ispras.ru (unknown [10.10.2.220]) by mail.ispras.ru (Postfix) with ESMTPS id 04CDA407625D; Wed, 11 Aug 2021 13:32:32 +0000 (UTC) From: Nadezda Lutovinova To: Andrzej Hajda Cc: Nadezda Lutovinova , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] media: s5p-mfc: Add checking to s5p_mfc_probe(). Date: Wed, 11 Aug 2021 16:32:28 +0300 Message-Id: <20210811133228.14657-1-lutovinova@ispras.ru> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If of_device_get_match_data() return NULL, then null pointer dereference occurs in s5p_mfc_init_pm(). The patch adds checking if dev->variant is NULL. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Nadezda Lutovinova --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index eba2b9f040df..b56ff75cb9cc 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1288,6 +1288,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) } dev->variant = of_device_get_match_data(&pdev->dev); + if (!dev->variant) { + dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n"); + return -ENOENT; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); dev->regs_base = devm_ioremap_resource(&pdev->dev, res); -- 2.17.1