From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8AB6C433DB for ; Wed, 30 Dec 2020 12:45:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF713221FA for ; Wed, 30 Dec 2020 12:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgL3Mpf (ORCPT ); Wed, 30 Dec 2020 07:45:35 -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: stable@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