Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp484540pxt; Thu, 12 Aug 2021 03:08:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRpz7oVAeDcL7aXtN4wYW7QV08moBu0kqwhdk7xtvuCcwebpZke13U2TYt2nlGIuqsXOq0 X-Received: by 2002:a17:906:12c6:: with SMTP id l6mr2963777ejb.373.1628762894565; Thu, 12 Aug 2021 03:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628762894; cv=none; d=google.com; s=arc-20160816; b=nafqR8rW1SktCk+3qi4BzvzT0BK/axU5uGNOjDWKHe0QNuFrbq4KZ2hPGrA9gskI73 zixV8MIv+kfKAyK+/Wkrj+IKydo+OS0L+qjnjxXTkOCaUmRFm48wmxA/7Z4+aphspnXb 9wFuLchZYAlNowDriDhtLe0/d/K1qAFbC/xEGvKZJ7Z+YJ4PKrdrRCryU+NX6kv41c2u 84b9TIVCGcVDfSopSt3JCrHUsbU/501sudI/iorowHg/RyJbTjGMAr+kPMlm3+9GMYMv 84E3oj2fyW5RTCeaPF/pDTo9DBegSsMSgg+wqEoJmNGJaigmE3KmKnOHtkOTgH+WIIZM vIWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=t52ah9sCNtHCqc326qvJ6uwJSGNRStNEar0xSoF/Pbg=; b=UHFGCuU4SdMgYuU1P7jkOY5enM2GnCsRB1KF58AaLrZxPFnNp+0bt7cU0oW1WArKrk wsdp4QVBJ+5h6zAeFUXfbZ8mlDzAoGrYLJ7Awqm9dk3Lw6SJaW0M2vhD7543phAMk8ti 0xTIEUTwTJm+d70Y+la3j+6ykmy1iRBmGXUKA8pqHzEuPglzAZotap/gRDsFI78SBsoZ 74PsGj1LzTqIDWbgpNruJjyTaCRcUYJJJXvU9ZiIfzVmoz/luVK4LVwYi5Ud0l5j9+YF pY31n3x3rUkRdjHpNOx50JtOYt1OaenLfcfDyL8ErEkLx5BplkRzEtXory3MgAIyFgGN y/gw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp12si1838559ejb.22.2021.08.12.03.07.50; Thu, 12 Aug 2021 03:08:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236146AbhHLJZ3 (ORCPT + 99 others); Thu, 12 Aug 2021 05:25:29 -0400 Received: from mslow1.mail.gandi.net ([217.70.178.240]:57953 "EHLO mslow1.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbhHLJZR (ORCPT ); Thu, 12 Aug 2021 05:25:17 -0400 Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 5F419CD329; Thu, 12 Aug 2021 09:15:41 +0000 (UTC) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1DE18FF80C; Thu, 12 Aug 2021 09:15:15 +0000 (UTC) Date: Thu, 12 Aug 2021 11:16:03 +0200 From: Jacopo Mondi To: Nadezda Lutovinova Cc: Niklas =?utf-8?Q?S=C3=B6derlund?= , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH v2] media: rcar-csi2: Add checking to rcsi2_start_receiver() Message-ID: <20210812091603.ahguetst2v354nla@uno.localdomain> References: <20210811171816.12012-1-lutovinova@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210811171816.12012-1-lutovinova@ispras.ru> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Nadezda, On Wed, Aug 11, 2021 at 08:18:16PM +0300, Nadezda Lutovinova wrote: > If rcsi2_code_to_fmt() return NULL, then null pointer dereference occurs > in the next cycle. That should not be possible now but adding checking > protects from future bugs. > The patch adds checking if format is NULL. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Nadezda Lutovinova Reviewed-by: Jacopo Mondi Thanks j > --- > v2: fix subject and commit message, remove dev_err() > --- > drivers/media/platform/rcar-vin/rcar-csi2.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c > index e28eff039688..d28f83f7698b 100644 > --- a/drivers/media/platform/rcar-vin/rcar-csi2.c > +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c > @@ -553,6 +553,8 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv) > > /* Code is validated in set_fmt. */ > format = rcsi2_code_to_fmt(priv->mf.code); > + if (!format) > + return -EINVAL; > > /* > * Enable all supported CSI-2 channels with virtual channel and > -- > 2.17.1 >