From patchwork Thu Apr 3 07:22:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 336541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9EB76140141 for ; Thu, 3 Apr 2014 18:23:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162410AbaDCHX3 (ORCPT ); Thu, 3 Apr 2014 03:23:29 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:18016 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162376AbaDCHX2 (ORCPT ); Thu, 3 Apr 2014 03:23:28 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s337NCfL001468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 Apr 2014 07:23:13 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s337N6IF005252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Apr 2014 07:23:10 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s337N5nv005248; Thu, 3 Apr 2014 07:23:05 GMT Received: from mwanda (/197.157.0.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Apr 2014 00:23:05 -0700 Date: Thu, 3 Apr 2014 10:22:54 +0300 From: Dan Carpenter To: Wolfram Sang Cc: Grant Likely , Rob Herring , Bjorn Andersson , Andy Gross , "Ivan T. Ivanov" , linux-i2c@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] i2c: qup: off by ones in qup_i2c_probe() Message-ID: <20140403072254.GB14286@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org These should ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()". Fixes: 10c5a8425968 ('i2c: qup: New bus driver for the Qualcomm QUP I2C controller') Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index c9d5f78..ee40980 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -633,12 +633,12 @@ static int qup_i2c_probe(struct platform_device *pdev) * associated with each byte written/received */ size = QUP_OUTPUT_BLOCK_SIZE(io_mode); - if (size > ARRAY_SIZE(blk_sizes)) + if (size >= ARRAY_SIZE(blk_sizes)) return -EIO; qup->out_blk_sz = blk_sizes[size] / 2; size = QUP_INPUT_BLOCK_SIZE(io_mode); - if (size > ARRAY_SIZE(blk_sizes)) + if (size >= ARRAY_SIZE(blk_sizes)) return -EIO; qup->in_blk_sz = blk_sizes[size] / 2;