Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbdLUPxe (ORCPT ); Thu, 21 Dec 2017 10:53:34 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:38098 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752222AbdLUPxS (ORCPT ); Thu, 21 Dec 2017 10:53:18 -0500 X-Google-Smtp-Source: ACJfBoud/Ay1fBErAM/lpqULw0+fGeMtcVVzObbLAA/rczgKiHAZETkTCAwbFEzR9ncSWNcgXLZuJg== From: Vasyl Gomonovych To: dan.j.williams@intel.com, vinod.koul@intel.com, dmaengine@vger.kernel.org, gomonovych@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] dmaengine: cppi41: Fix channel queues array size check Date: Thu, 21 Dec 2017 16:53:04 +0100 Message-Id: <1513871584-8783-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 747 Lines: 22 The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE(). Signed-off-by: Vasyl Gomonovych --- drivers/dma/cppi41.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index f7e965f63274..d9bee65a18a4 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -934,7 +934,7 @@ static bool cpp41_dma_filter_fn(struct dma_chan *chan, void *param) BUILD_BUG_ON(ARRAY_SIZE(am335x_usb_queues_rx) != ARRAY_SIZE(am335x_usb_queues_tx)); - if (WARN_ON(cchan->port_num > ARRAY_SIZE(am335x_usb_queues_rx))) + if (WARN_ON(cchan->port_num >= ARRAY_SIZE(am335x_usb_queues_rx))) return false; cchan->q_num = queues[cchan->port_num].submit; -- 1.9.1