Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752676AbdDIUa2 (ORCPT ); Sun, 9 Apr 2017 16:30:28 -0400 Received: from smtpoutz300.laposte.net ([178.22.154.200]:39156 "EHLO smtp.laposte.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752463AbdDIUaT (ORCPT ); Sun, 9 Apr 2017 16:30:19 -0400 X-Greylist: delayed 1499 seconds by postgrey-1.27 at vger.kernel.org; Sun, 09 Apr 2017 16:30:19 EDT From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Vincent=20Stehl=C3=A9?= , Mark Brown Subject: [PATCH] regulator: isl9305: fix array size Date: Sun, 9 Apr 2017 22:05:05 +0200 Message-Id: <20170409200505.10701-1-vincent.stehle@laposte.net> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-VR-SrcIP: 88.178.86.202 X-VR-FullState: 0 X-VR-Score: 0 X-VR-Cause-1: gggruggvucftvghtrhhoucdtuddrfeeliedruddtgddugeejucetufdoteggodetrfdotffvucfrrhho X-VR-Cause-2: fhhilhgvmecunfetrffquffvgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffk X-VR-Cause-3: ofggtgfgsehtkeertdertdejnecuhfhrohhmpeggihhntggvnhhtucfuthgvhhhlrocuoehvihhntggv X-VR-Cause-4: nhhtrdhsthgvhhhlvgeslhgrphhoshhtvgdrnhgvtheqnecukfhppeekkedrudejkedrkeeirddvtddv X-VR-Cause-5: necurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghloheprhhomhhurghlugdrsggvrhhgvghr X-VR-Cause-6: ihgvpdhinhgvthepkeekrddujeekrdekiedrvddtvddpmhgrihhlfhhrohhmpehvihhntggvnhhtrdhs X-VR-Cause-7: thgvhhhlvgeslhgrphhoshhtvgdrnhgvthdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhg X-VR-Cause-8: vghrrdhkvghrnhgvlhdrohhrgh X-VR-AvState: No X-VR-State: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1021 Lines: 30 ISL9305_MAX_REGULATOR is the last index used to access the init_data[] array, so we need to add one to this last index to obtain the necessary array size. This fixes the following smatch error: drivers/regulator/isl9305.c:160 isl9305_i2c_probe() error: buffer overflow 'pdata->init_data' 3 <= 3 Fixes: dec38b5ce6a9edb4 ("regulator: isl9305: Add Intersil ISL9305/H driver") Signed-off-by: Vincent Stehlé Cc: Mark Brown --- include/linux/platform_data/isl9305.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/platform_data/isl9305.h b/include/linux/platform_data/isl9305.h index 1419133fa69e..4ac1a070af0a 100644 --- a/include/linux/platform_data/isl9305.h +++ b/include/linux/platform_data/isl9305.h @@ -24,7 +24,7 @@ struct regulator_init_data; struct isl9305_pdata { - struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR]; + struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR + 1]; }; #endif -- 2.11.0