From patchwork Fri Jul 11 15:19:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 4535231 Return-Path: X-Original-To: patchwork-linux-media@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 D2A8ABEECB for ; Fri, 11 Jul 2014 15:29:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2564520204 for ; Fri, 11 Jul 2014 15:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 744852025B for ; Fri, 11 Jul 2014 15:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932074AbaGKPUF (ORCPT ); Fri, 11 Jul 2014 11:20:05 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:64325 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753922AbaGKPT6 (ORCPT ); Fri, 11 Jul 2014 11:19:58 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8J00G9ZZX92160@mailout4.samsung.com> for linux-media@vger.kernel.org; Sat, 12 Jul 2014 00:19:57 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-17-53c0009cb57b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 19.3D.04943.C9000C35; Sat, 12 Jul 2014 00:19:57 +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 <0N8J00DPYZWYA170@mmp1.samsung.com>; Sat, 12 Jul 2014 00:19:56 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, andrzej.p@samsung.com, Jacek Anaszewski , Kyungmin Park Subject: [PATCH v2 2/9] s5p-jpeg: return error immediately after get_byte fails Date: Fri, 11 Jul 2014 17:19:43 +0200 Message-id: <1405091990-28567-3-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405091990-28567-1-git-send-email-j.anaszewski@samsung.com> References: <1405091990-28567-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsVy+t9jAd25DAeCDVb0slvMetnOYtF79Tmj xdmmN+wWPRu2slocftPO6sDq0bdlFaPH501yAUxRXDYpqTmZZalF+nYJXBldTxQLnrNXtC2a xNLAuISti5GDQ0LAROLQTfYuRk4gU0ziwr31QGEuDiGBRYwSMxbMYAVJCAm0M0lsXxcJYrMJ GEr8fPGaCcQWEZCXeNJ7A6yBWaCXUeLcv18sIAlhAX+JhRe62EEWsAioSrTstgEJ8wp4SPx/ voAZYq+CxJxJYGFOAU+Js9dXsECs8pD40b2IfQIj7wJGhlWMoqkFyQXFSem5hnrFibnFpXnp esn5uZsYwcHxTGoH48oGi0OMAhyMSjy8Cuv3BQuxJpYVV+YeYpTgYFYS4b36Zn+wEG9KYmVV alF+fFFpTmrxIUZpDhYlcd4DrdaBQgLpiSWp2ampBalFMFkmDk6pBkYeZv6pLvPqayteqGvy XJ54cibnhXndypO/7L6c8TjCVE7wtz5DQFLABeW1SiJH1rnemln10PXxxg5u/rcsX5oj4gUP yXxldHr8YLY/51z9pb6uB1vUfNdZJiu0XesUeBfzZ+/3tQyvu0yuXOfJenbxy/6UtNvtnC47 9VuWnTPxd7Jk3v049oYSS3FGoqEWc1FxIgDXG/zbCgIAAA== 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.5 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;