Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10504939pxu; Wed, 30 Dec 2020 04:46:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzC4uzNScWHo1vynM+gsEkJNkn7m42bk6+fJzTvpm5zipe9fdo6Z12FsNU9WFpQH1uI3hR X-Received: by 2002:a50:f745:: with SMTP id j5mr49581766edn.92.1609332416440; Wed, 30 Dec 2020 04:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609332416; cv=none; d=google.com; s=arc-20160816; b=dX75kktJiwkYVLj5CLtgEvz7U19phCN8KfB7QbjyBIAFkhu0S7uNjvnnIarUWB42Ux nlTPeahTD4I3f4zdTTNodCi9slqR+gMQsy0IrOg6ozlbhb6nEAPObMYybM/LxVgoJKRc 4FPyhGzmgpIsXJDUf52gNHgw2eHLiW+SdtbILbzxwg04MZweTUv4Fjm8/DwkR1qzUU9R O7nI0vcvajm3SlqHT6tswLtrhLSRXtiS+0wDQUOKRjOqT8E0vKXbRLL/9JVNSrVeMpRA M5SgND3n6c6wJ4h/dTwy4dofYzll5bYh4qXxxY26AGeyodfoRj/e9x9v/cztmGya1JeQ ZOJQ== 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:dkim-signature; bh=rfVlQ9m73SmrwoADz8VIu8q/9AifRgILJ78Xs2KQAHA=; b=OHiIPnLt0UaGb/st96vgV5Wm4tu9h84RiXokRLEJ+xIiUwp3RF20MGQKZwjWvbCinH 2BV0beRlvVuLqwEihVUESJuBRurdsCeAtJXGPIyEF8wLAbnz2+SHXofbN+rbwJLCyidh JxtyyfSRe/Yrb4nJZGRRmk1qJZPI3bCbeOqGq7/mpgzbMUecm2N/9keFZ5kQ0ZFeJhU1 iKnsLy16+iuq/2Uc7uvqmy9n7Z3X7kdm9gn5mVUYMUHqFqkzz2h8lMaxKtFJCUg/mUw3 qo0UZz2PGhzhSEMfMsGCjCmQOXfLQd2/f2dDJ6Sq4p4N/vYMaKsdsqQ8rF+5IUS0xk6j isQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=uevXKJ2r; 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 j24si21669191ejd.743.2020.12.30.04.46.34; Wed, 30 Dec 2020 04:46:56 -0800 (PST) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=uevXKJ2r; 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 S1726744AbgL3Mpg (ORCPT + 99 others); Wed, 30 Dec 2020 07:45:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbgL3Mpf (ORCPT ); Wed, 30 Dec 2020 07:45:35 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB09C061799; Wed, 30 Dec 2020 04:44:55 -0800 (PST) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A7FE62A3; Wed, 30 Dec 2020 13:44:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1609332292; bh=N+MD8mxlPXnOnzIDjroQAQZ5KolfEPGJfCr+iUEPOlA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uevXKJ2rNoCc5LwVn+NT8iESWfmswY4JXvrb8p+P0T+NKsZ4Fyvis9PlnYw8LHftc bK0xt+tnlWOjCVv/OD1x3AHFYtVcf68ck3I1NDorJd+xRKnJn8EmcPwrs/SMSh5hvH zG1VeUqxfQM4D/QHl6mJhiBKfhzSwNvb/NF+Ftsc= Date: Wed, 30 Dec 2020 14:44:41 +0200 From: Laurent Pinchart To: Andy Shevchenko Cc: Pavel Machek , Greg Kroah-Hartman , Linux Kernel Mailing List , Stable , Sakari Ailus , Mauro Carvalho Chehab Subject: Re: [PATCH 5.10 527/717] media: ipu3-cio2: Validate mbus format in setting subdev format Message-ID: References: <20201228125020.963311703@linuxfoundation.org> <20201228125046.214023397@linuxfoundation.org> <20201230122508.GA12190@duo.ucw.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 30, 2020 at 02:32:46PM +0200, Andy Shevchenko wrote: > On Wed, Dec 30, 2020 at 2:25 PM Pavel Machek wrote: > > > > commit a86cf9b29e8b12811cf53c4970eefe0c1d290476 upstream. > > > > > > Validate media bus code, width and height when setting the subdev format. > > > > > > This effectively reworks how setting subdev format is implemented in the > > > driver. > > > > Something is wrong here: > > > > > + fmt->format.code = formats[0].mbus_code; > > > + for (i = 0; i < ARRAY_SIZE(formats); i++) { > > Looks like 'i = 1' should be... > > > > + if (formats[i].mbus_code == fmt->format.code) { More likely if (formats[i].mbus_code == mbus_code) { I think. Pavel, would you like to submit a patch ? > > > + fmt->format.code = mbus_code; > > > + break; > > > + } > > > > This does not make sense. Loop will always exit during the first > > iteration, making the whole loop crazy/redundant. -- Regards, Laurent Pinchart