From patchwork Tue Jul 2 00:52:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 2810511 Return-Path: X-Original-To: patchwork-dri-devel@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 6FDB09F3C3 for ; Tue, 2 Jul 2013 00:52:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A44C2010B for ; Tue, 2 Jul 2013 00:52:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5504D200F0 for ; Tue, 2 Jul 2013 00:52:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D077E617D for ; Mon, 1 Jul 2013 17:52:04 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 04795E5CBD for ; Mon, 1 Jul 2013 17:51:53 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MPA00HWCAE4DD60@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Tue, 02 Jul 2013 09:51:51 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.112]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 07.9B.11618.72422D15; Tue, 02 Jul 2013 09:51:51 +0900 (KST) X-AuditID: cbfee691-b7fef6d000002d62-cb-51d224277b4f Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0A.A7.28381.72422D15; Tue, 02 Jul 2013 09:51:51 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MPA008TSAECWB20@mmp2.samsung.com>; Tue, 02 Jul 2013 09:51:50 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, airlied@linux.ie Subject: [PATCH v2 2/3] drm: add assertion for checking null edid to drm_edid_block_valid Date: Tue, 02 Jul 2013 09:52:02 +0900 Message-id: <1372726322-29261-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsWyRsSkQFdd5VKgwdUHvBa9504yWdx8eJbV 4v+2icwWV76+Z7M42/SG3WLG5JdsFnt3TmZ0YPdY+UHLY++3BSwe2789YPW4332cyaNvyyrG ANYoLpuU1JzMstQifbsErozPM/axF7zkrnjdeputgXE3ZxcjJ4eEgInE3UWXGSFsMYkL99az dTFycQgJLGWU2NmwjAmm6OXJk8wQiemMEo9uPmGBcJqZJC4v+M8CUsUmoCOxf8lvVhBbRMBU 4uzla0AdHBzMAhUSnWs0QExhgWiJB7vNQSpYBFQluubPZAOxeQXcJGb/bWOB2KUgseDeW7A4 p0CwxOZFf8HiQgIBEpv6d4GtlRCYxy6x7OAiZohBAhLfJh9iAZkvISArsekAM8QcSYmDK26w TGAUXsDIsIpRNLUguaA4Kb3IVK84Mbe4NC9dLzk/dxMjMMhP/3s2cQfj/QPWhxiTgcZNZJYS Tc4HRkleSbyhsZmRhamJqbGRuaUZacJK4rzqLdaBQgLpiSWp2ampBalF8UWlOanFhxiZODil GhitM+bGZuq9ZQ3kdbGs+B502LRXKrox6aL209p9DVnh2ot5wp9uyov3ztTV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reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, yj44.cho@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 If raw_edid of drm_edid_block_vaild() is null, it will crash, so checking in bad label is removed and instead assertion is added at the top of the function. The type of return for the function is bool, so it fixes to return true and false instead of 1 and 0. Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park --- chages from v1 - NULL checking is replaced with WARN_ON() as Daniel commented - all return value is replaced as true/false as Chris and Daniel commented drivers/gpu/drm/drm_edid.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 2dc1a60..1117f02 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -968,6 +968,8 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) u8 csum = 0; struct edid *edid = (struct edid *)raw_edid; + WARN_ON(!raw_edid); + if (edid_fixup > 8 || edid_fixup < 0) edid_fixup = 6; @@ -1010,15 +1012,15 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) break; } - return 1; + return true; bad: - if (raw_edid && print_bad_edid) { + if (print_bad_edid) { printk(KERN_ERR "Raw EDID:\n"); print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, raw_edid, EDID_LENGTH, false); } - return 0; + return false; } EXPORT_SYMBOL(drm_edid_block_valid);