Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp577743pxt; Thu, 12 Aug 2021 05:13:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykNHQqgx4USW2MTMsHro2Tk83C80YGsIPt6hATVHYnm84aFycGY/N54z295jH2zqMjzKuV X-Received: by 2002:a05:6402:557:: with SMTP id i23mr5001021edx.373.1628770436868; Thu, 12 Aug 2021 05:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628770436; cv=none; d=google.com; s=arc-20160816; b=ubAYX85pm54UjqBQN1djKE06cubiI+4kbFf4fo3BnccjxLlnMj9RB+nr+27/zWYb6U CYX6hRDbXzi/4b+h1S4gE/uKHX+htb8pWLTzDqNmTf63ED3Bxq8DfNs2SeRRodutAP7e pj7Xpei/fAY6QRHjuPO9KxBR0eEQJynZdaSzLeSYcn2GH70SNHI/yxL7xvG8G0OAJAfj YaACk4tw7VcFyaJN0DfsLCeRlXAxr+1ZumyrS0THpD4na7YY5jJaqhZi/qoZyTCw847G sbuOBIwmRoXISxZclcENIQxyzR4HwAQaM9VxKVYtljse8PmImHc0zApsNXsTKNBFpG81 d/DA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=epgC7K+n2/X6KUKBrCcOah3EpzEkojXbDo2MF6JX8Po=; b=kxz65wpZOLLbkVDU8hCMUFS1UnHzoPJDVHQxELOnf3I+5RPSRLHffWxTQslSAF5I/8 vras8H53bG+7brqwaeuDxw8MfKpsllMyO2V74jwpX7YhJwR4IsWdM4gB3nRLZFEvO4cH N25ltErujrgsK6DeEtgJyIZkGyKpoadeH3v/GvajBr9ywUnHZaVGF73MJd0wZmSdWLej sHW3ZyGYJwI1811iqUQSDCjoiLY6xy7iuGpYBz9KfZwHHqA+EmId6xWt4jTaLIqNLkqg R3kXoHPcwrZUhepN7rdsfb2UCNI7OTEKGcwPbJJjD4GO7jvX0hzKbtNxdlLtooeNhPxz Ab0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=dCiBJO2W; 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 v23si2245921eds.259.2021.08.12.05.13.32; Thu, 12 Aug 2021 05:13:56 -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; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=dCiBJO2W; 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 S235008AbhHLJbQ (ORCPT + 99 others); Thu, 12 Aug 2021 05:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235052AbhHLJbP (ORCPT ); Thu, 12 Aug 2021 05:31:15 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36CA5C061765 for ; Thu, 12 Aug 2021 02:30:49 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id w20so12289596lfu.7 for ; Thu, 12 Aug 2021 02:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=epgC7K+n2/X6KUKBrCcOah3EpzEkojXbDo2MF6JX8Po=; b=dCiBJO2WWr87RMNsBVrMDbxnySWA9MkXRmEO7aAGTRlLXQxAyhbo5tf8tPH/Bn86YR GDqNPJw4volwsjrEBz2IR2X3Cfa5lqggF63+2yJIMWGYLzHpoczM7Y2uZKyMznPB0INt aZBfzUQIDQJ7In7d2GsVdA5f1OdGkqMXxnNWOGitx+FszPXOOqhfgyFvi3vubWcSxh4C Sj7oB1OqFQs1OkiVDFGb+4ql0FQdL9jYKD78SoM8N1DlOF290BnUR8/Ln50UFzK3F+7f T+nrATKH4+WuXFXlWlgI6XoPHridFk1ti3n2OyoxCT+h1PlGqBUNFubDH/rVuJbeM/t4 XoqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=epgC7K+n2/X6KUKBrCcOah3EpzEkojXbDo2MF6JX8Po=; b=GZaSRcCUtYm4rVacF+atr54Wx0yLYm4DmdEPdNG/3qt0MJ1WvemTfRTSKQN8Cj0jd8 RTECNhRhgLv30VGXBHJ9ObUvk50kUCMBNJpbSVR2jS5gjBlhmqhVYIYL6mtPOJ7HK3Oq /07+nEMfr1ZhcHRZ7CTrdKvzU0fbVqSi+KirtqtJp/NHDusmsYcERiDf7gnGAR/EQD/N 9HR53Glo7+JP8RpOtSBSr+5Pzat/4xBBz7UyQ84ti6Sflt97efkrk+LSEsLct/8bRmR3 fEriWqb0R8UxYU3FrJUHZAYHwLw2/OYwZ3H61k6SCjh+sxn8VPl9HT1BAwxJVCqlvRNu 50wQ== X-Gm-Message-State: AOAM5300Thjw9obZ9opx2RMy5fBFbq/7u9atY7hlafkcGXbNCeV18ulY o6+gpVj9L2KY4Uv5rFiTwfC5fH+QKR3nyg== X-Received: by 2002:a05:6512:23a6:: with SMTP id c38mr1995349lfv.268.1628760647574; Thu, 12 Aug 2021 02:30:47 -0700 (PDT) Received: from localhost (h-46-59-88-219.A463.priv.bahnhof.se. [46.59.88.219]) by smtp.gmail.com with ESMTPSA id k17sm248789ljm.7.2021.08.12.02.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 02:30:47 -0700 (PDT) Date: Thu, 12 Aug 2021 11:30:46 +0200 From: Niklas =?iso-8859-1?Q?S=F6derlund?= To: Nadezda Lutovinova Cc: 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: References: <20210811171816.12012-1-lutovinova@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210811171816.12012-1-lutovinova@ispras.ru> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nadezda, Thanks for your patch. On 2021-08-11 20:18:16 +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: Niklas S?derlund > --- > 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 > -- Regards, Niklas S?derlund