From patchwork Tue Nov 19 14:26:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 3202451 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B7DB9F26C for ; Tue, 19 Nov 2013 14:27:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06FBA20318 for ; Tue, 19 Nov 2013 14:27:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A22752037D for ; Tue, 19 Nov 2013 14:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752930Ab3KSO1g (ORCPT ); Tue, 19 Nov 2013 09:27:36 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:55579 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752798Ab3KSO1d (ORCPT ); Tue, 19 Nov 2013 09:27:33 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MWI00M2HLHQNH40@mailout3.samsung.com> for linux-media@vger.kernel.org; Tue, 19 Nov 2013 23:27:32 +0900 (KST) X-AuditID: cbfee61b-b7fd56d000001fc6-56-528b75533025 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 59.46.08134.3557B825; Tue, 19 Nov 2013 23:27:31 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MWI00IBKLHFEGB0@mmp1.samsung.com>; Tue, 19 Nov 2013 23:27:31 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, s.nawrocki@samsung.com, sw0312.kim@samsung.com, Jacek Anaszewski Subject: [PATCH 03/16] s5p-jpeg: Fix erroneous condition while validating bytesperline value Date: Tue, 19 Nov 2013 15:26:55 +0100 Message-id: <1384871228-6648-4-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1384871228-6648-1-git-send-email-j.anaszewski@samsung.com> References: <1384871228-6648-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t9jAd3g0u4gg8ndNha9V58zWpxtesNu 0bNhK6vF4TftrBYzJr9kc2D16NuyitHj8ya5AKYoLpuU1JzMstQifbsEroxdO7uZCo5wVqyb 0MXWwPiCvYuRk0NCwETiYd85KFtM4sK99WxdjFwcQgKLGCXaPy5jgXDamSS+rf7BClLFJmAo 8fPFayYQW0RAXuJJ7w02EJtZoEZiytYbYJOEBeIkZu58xwJiswioSlxduYgRxOYVcJc40bMU KM4BtE1BYs4kG5Awp4CHxJSF28FahYBKzm88yT6BkXcBI8MqRtHUguSC4qT0XCO94sTc4tK8 dL3k/NxNjOAQeSa9g3FVg8UhRgEORiUe3gnuXUFCrIllxZW5hxglOJiVRHgb87uDhHhTEiur Uovy44tKc1KLDzFKc7AoifMebLUOFBJITyxJzU5NLUgtgskycXBKNTAacBf9eH1JWCoiqMuG /1f/wwLOh7NnFx6x3XRwueGRrdJ3+qP6xO1adC8aJMv3HP9867lJ47WcY5aetj22cySmTdji JF8mxjBhhdYt930GSUZHj84+67q3W8Z0rfwWvY3HxO3XRRsfyjl7MfZX/Qz+O+Itz89ku3Zc mr5jE9veMyqfF89Q1q1XYinOSDTUYi4qTgQABS//Hg0CAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The aim of the condition is ensuring that the bytesperline value set by the user space application is proper for the given format and adjusting it if isn't. As the depth value of the format description entry is expressed in bits then the bytesperline value needs to be divided, not multiplied, by that value to get the number of bytes required to store single line of image samples. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 0f567c5..a1366f0 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -670,7 +670,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct s5p_jpeg_fmt *fmt, bpl = pix->width; /* planar */ if (fmt->colplanes == 1 && /* packed */ - (bpl << 3) * fmt->depth < pix->width) + (bpl << 3) / fmt->depth < pix->width) bpl = (pix->width * fmt->depth) >> 3; pix->bytesperline = bpl;