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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 8409DC433ED for ; Thu, 1 Apr 2021 11:30:50 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF800610CB for ; Thu, 1 Apr 2021 11:30:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF800610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v9T7d5MMC7mrUi29qmLdCx4RN24XB/ThmgNNACAB4ek=; b=b335FhtQYqSFlGhizv8vjQvTm LkoDaQaEjk6bmZWz+awQ6dA751zqbWSLvSESmI2RgQO+5vR+G+tAT3/x4k0GX6Uq8J1qaMugo4Iyc ZYvRp9phDC/nZJgc4Utqt6bQux6jHvSZZeqZbk4LWN0KMojrUodtig5iquui7rnusaFAkUKzVm4TJ db0JhdYqTvBojy2jQb4deCq1Mo7458bbKW3Vsvc0h4XUzMYfPSsj+U6F3gqOpdCSIZ257pBD8aGcf z019XBCL+YyV/v4HTc3nfbAG8Ay28FotsmYpOtxFfUhlm6nXCLq8gls4trqOpiXPvrOjLdwZqIPwK bqfjA1yuA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRvVn-009REJ-6U; Thu, 01 Apr 2021 11:29:19 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRvVa-009RAa-FQ for linux-arm-kernel@lists.infradead.org; Thu, 01 Apr 2021 11:29:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1617276546; x=1648812546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W9RTc4XTqmuga+DzPKp51siwwTSJHh6dtg9LlNk0M14=; b=1ZsYiGbtUWrfd8nGTEtzZG9bPVVKHJaV4PNd0ZKB5X+fvmChebqKI2XR h/lLPzhnqWyavZ3/ZCT9xJoU4fzBTonw8h+xi4kwbEVxqf4Q8Ap8LdcYy bRZP9XCuhdLF8BQpq3sZ64K2zAgMh92+3TsyIPnb2XhgwFwiSA1WuTiZI hEKE/OHfcZdVN/S193DMCuNw+nacMKdNwg/aeZ1hJXwOyvRHlsqk4H44o +U0YhD2yQJA6D/v+dPqkNCN3ktiYctrBdWlAMDxUw4vK9CKAh8Z7gJKgF doi5WRVUra4Rqrb0bSyjSXlAl9guAQ6EBjbH1uz+/3YOuMzsvnOEhI8+C A==; IronPort-SDR: K+0CHeN8sXO2Clckg6iw7tDsPSThzOwwt247IYudrwp2ws8cRp42hOdW7SP6Q6MpJ/+4cANq0p 92VHzAhq0XZ2yCzUJD8z+D4g86MQQRseco5iUctWGUcfXml7tCvqwzDffzMfAgvC/tHw8BPV5v Cy+mdavvgdXvkn1Ojk5j3PdZhXHF03dWRLu1SVjtyVtf0ExBzypqZrodhdOF9D9Xy4kq+gTZDH E++Ezx5fAaHP0C0hL9ba+Yv87H4XY8Fyjg7UfWzHeESJSPBqC6FCglMSTlAs5Dto5NRn6abbfe JQg= X-IronPort-AV: E=Sophos;i="5.81,296,1610434800"; d="scan'208";a="49670689" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Apr 2021 04:29:04 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 1 Apr 2021 04:29:04 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Thu, 1 Apr 2021 04:29:02 -0700 From: Eugen Hristev To: , CC: , , Eugen Hristev Subject: [PATCH 03/30] media: atmel: atmel-isc: add checks for limiting frame sizes Date: Thu, 1 Apr 2021 14:26:56 +0300 Message-ID: <20210401112723.189107-4-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210401112723.189107-1-eugen.hristev@microchip.com> References: <20210401112723.189107-1-eugen.hristev@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210401_122906_940128_04D5E898 X-CRM114-Status: UNSURE ( 9.74 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When calling the subdev, certain subdev drivers will overwrite the frame size and adding sizes which are beyond the ISC's capabilities. Thus we need to ensure the frame size is cropped to the maximum caps. Signed-off-by: Eugen Hristev --- drivers/media/platform/atmel/atmel-isc-base.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index 277a8fd8b83d..45fc8dbb7943 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -1326,6 +1326,12 @@ static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f, v4l2_fill_pix_format(pixfmt, &format.format); + /* Limit to Atmel ISC hardware capabilities */ + if (pixfmt->width > ISC_MAX_SUPPORT_WIDTH) + pixfmt->width = ISC_MAX_SUPPORT_WIDTH; + if (pixfmt->height > ISC_MAX_SUPPORT_HEIGHT) + pixfmt->height = ISC_MAX_SUPPORT_HEIGHT; + pixfmt->field = V4L2_FIELD_NONE; pixfmt->bytesperline = (pixfmt->width * isc->try_config.bpp) >> 3; pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height; @@ -1361,6 +1367,12 @@ static int isc_set_fmt(struct isc_device *isc, struct v4l2_format *f) if (ret < 0) return ret; + /* Limit to Atmel ISC hardware capabilities */ + if (pixfmt->width > ISC_MAX_SUPPORT_WIDTH) + pixfmt->width = ISC_MAX_SUPPORT_WIDTH; + if (pixfmt->height > ISC_MAX_SUPPORT_HEIGHT) + pixfmt->height = ISC_MAX_SUPPORT_HEIGHT; + isc->fmt = *f; if (isc->try_config.sd_format && isc->config.sd_format && -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel