From patchwork Mon Jul 7 16:32:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 4496251 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B3D0ABEECB for ; Mon, 7 Jul 2014 16:32:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB53E20306 for ; Mon, 7 Jul 2014 16:32:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C542202F0 for ; Mon, 7 Jul 2014 16:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342AbaGGQcu (ORCPT ); Mon, 7 Jul 2014 12:32:50 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:57752 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbaGGQct (ORCPT ); Mon, 7 Jul 2014 12:32:49 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8C00I0IOMOAI70@mailout3.samsung.com>; Tue, 08 Jul 2014 01:32:48 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-bc-53bacbb04a50 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EA.14.04943.0BBCAB35; Tue, 08 Jul 2014 01:32:48 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8C00GK8OLKQW00@mmp2.samsung.com>; Tue, 08 Jul 2014 01:32:48 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, b.zolnierkie@samsung.com, linux-samsung-soc@vger.kernel.org, Jacek Anaszewski Subject: [PATCH 2/9] s5p-jpeg: return error immediately after get_byte fails Date: Mon, 07 Jul 2014 18:32:03 +0200 Message-id: <1404750730-22996-3-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1404750730-22996-1-git-send-email-j.anaszewski@samsung.com> References: <1404750730-22996-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsVy+t9jQd0Np3cFGxydJWyxccZ6Voveq88Z Lc42vWG36NmwldVixvl9TA6sHn1bVjF6fN4kF8AUxWWTkpqTWZZapG+XwJXR9USx4Dl7Rdui SSwNjEvYuhg5OCQETCQOTNLpYuQEMsUkLtxbDxTm4hASmM4osW9RKyOE084kceDxf0aQKjYB Q4mfL14zgdgiAvIST3pvgHUwC3QySixs38AKkhAW8JFoXnMFzGYRUJW4cWQfM8g2XgEPiVeL qyEWK0jMmWQDUsEp4ClxeNlnVpCwEFDFwdeWExh5FzAyrGIUTS1ILihOSs811CtOzC0uzUvX S87P3cQIDo5nUjsYVzZYHGIU4GBU4uFdcXBXsBBrYllxZe4hRgkOZiUR3hXLgUK8KYmVValF +fFFpTmpxYcYpTlYlMR5D7RaBwoJpCeWpGanphakFsFkmTg4pRoYA3nLZt61c2l/0VMwOzrf d86v+91M0bJTFpu3rVoor3D2QUd1+rTpMpxaJv8XKlyb//pSrCCvp+35+wHsBczn8ll1vX4m d5zlWnHhl3xzbFGStma4RsfV1S3H+PKWmb+rSM22CDiwTD1S6E+jcDH/I+PTHqcyju+7V1bl M3uhy60FrjzfuWcpsRRnJBpqMRcVJwIAu+sWxwoCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 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 When parsing JPEG header s5p_jpeg_parse_hdr function should return immediately in case there was an error while reading a byte. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 7d604f2..df3aaa9 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -906,14 +906,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result, while (notfound) { c = get_byte(&jpeg_buffer); if (c == -1) - break; + return false; if (c != 0xff) continue; do c = get_byte(&jpeg_buffer); while (c == 0xff); if (c == -1) - break; + return false; if (c == 0) continue; length = 0;