From patchwork Fri Jul 18 16:31:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 4586501 Return-Path: X-Original-To: patchwork-davinci@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 131609F37C for ; Fri, 18 Jul 2014 16:33:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1669920125 for ; Fri, 18 Jul 2014 16:33:27 +0000 (UTC) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D22BE2010C for ; Fri, 18 Jul 2014 16:33:25 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6IGWMVP007937; Fri, 18 Jul 2014 11:32:22 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6IGWK4m020393; Fri, 18 Jul 2014 11:32:20 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 18 Jul 2014 11:32:20 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6IGWJPG010191; Fri, 18 Jul 2014 11:32:19 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id E9A7E80627; Fri, 18 Jul 2014 11:32:18 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id DC49980626 for ; Fri, 18 Jul 2014 11:32:16 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6IGWG3D006467 for ; Fri, 18 Jul 2014 11:32:16 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6IGWE8f021688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Jul 2014 11:32:16 -0500 Received: from [216.82.241.195:8801] by server-12.bemta-8.messagelabs.com id B9/47-05019-D0C49C35; Fri, 18 Jul 2014 16:32:13 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-16.tower-119.messagelabs.com!1405701131!34254094!1 X-Originating-IP: [74.125.82.170] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15537 invoked from network); 18 Jul 2014 16:32:12 -0000 Received: from mail-we0-f170.google.com (HELO mail-we0-f170.google.com) (74.125.82.170) by server-16.tower-119.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2014 16:32:12 -0000 Received: by mail-we0-f170.google.com with SMTP id w62so4849560wes.15 for ; Fri, 18 Jul 2014 09:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=+SJ4pNPAmhoVOJ/JeMgoenW7xuvT4zE9u+c8BXvWcEg=; b=F0Fka6toAEXgPwYIJB2u0hJSdkQEg+eA7lkJ+pl6SfYIJJtMYE9dDyGeNg6blmobil xAvdRWDJTlqzykQub5DLzJ+Lt6admHJZbdCpZu4HRg/oDxMPEKkhhpn3CSM1Sa8Q8juA +DzI67/hos2BRIFrbgOSeKmLzqrcDslYeyFNNNhc2mz5QrujMXWOMZv2OEhjux4+Hhje G44+kC9O97QhuOGdUAOqNf9hG8bUQbv8FLtCI+AQlMX4m7CL+BZddT+k8JGj5B+ucXTS 6ug8X2G/+3buMahyDYBaD2lgMVoUdoKvnlTxoT2k7mQGPw7uSrN1eKwWamryCmN0vDi/ ELvQ== X-Received: by 10.180.182.67 with SMTP id ec3mr9413148wic.21.1405701131389; Fri, 18 Jul 2014 09:32:11 -0700 (PDT) Received: from tango-charlie.RL.local ([194.72.83.162]) by mx.google.com with ESMTPSA id cz8sm15364250wjc.11.2014.07.18.09.32.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Jul 2014 09:32:10 -0700 (PDT) From: "Lad, Prabhakar" To: Hans Verkuil , LMML Subject: [PATCH] media: davinci: vpif: fix array out of bound warnings Date: Fri, 18 Jul 2014 17:31:51 +0100 Message-ID: <1405701111-26983-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 This patch fixes following array out of bound warnings, drivers/media/platform/davinci/vpif_display.c: In function 'vpif_remove': drivers/media/platform/davinci/vpif_display.c:1389:36: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] vb2_dma_contig_cleanup_ctx(common->alloc_ctx); ^ drivers/media/platform/davinci/vpif_display.c:1385:2: note: containing loop for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) { ^ drivers/media/platform/davinci/vpif_capture.c: In function 'vpif_remove': drivers/media/platform/davinci/vpif_capture.c:1581:36: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] vb2_dma_contig_cleanup_ctx(common->alloc_ctx); ^ drivers/media/platform/davinci/vpif_capture.c:1577:2: note: containing loop for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { ^ drivers/media/platform/davinci/vpif_capture.c:1580:23: warning: array subscript is above array bounds [-Warray-bounds] common = &ch->common[i]; Reported-by: Hans Verkuil Signed-off-by: Lad, Prabhakar Acked-by: Sakari Ailus --- drivers/media/platform/davinci/vpif_capture.c | 2 +- drivers/media/platform/davinci/vpif_display.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 2f90f0d..3a85238 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1577,7 +1577,7 @@ static int vpif_remove(struct platform_device *device) for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { /* Get the pointer to the channel object */ ch = vpif_obj.dev[i]; - common = &ch->common[i]; + common = &ch->common[VPIF_VIDEO_INDEX]; vb2_dma_contig_cleanup_ctx(common->alloc_ctx); /* Unregister video device */ video_unregister_device(ch->video_dev); diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 0bd6dcb..6c6bd6b 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1385,7 +1385,7 @@ static int vpif_remove(struct platform_device *device) for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) { /* Get the pointer to the channel object */ ch = vpif_obj.dev[i]; - common = &ch->common[i]; + common = &ch->common[VPIF_VIDEO_INDEX]; vb2_dma_contig_cleanup_ctx(common->alloc_ctx); /* Unregister video device */ video_unregister_device(ch->video_dev);