Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760AbdCNVMm (ORCPT ); Tue, 14 Mar 2017 17:12:42 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59123 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbdCNVMk (ORCPT ); Tue, 14 Mar 2017 17:12:40 -0400 From: Arnd Bergmann To: Nishanth Menon , Tero Kristo , Santosh Shilimkar Cc: Arnd Bergmann , Dave Gerlach , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] firmware: ti_sci: fix strncat length check Date: Tue, 14 Mar 2017 22:11:40 +0100 Message-Id: <20170314211157.3424031-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:L+MAIF2dYPkdkkq+LCGh0ITxLz36EfxFGq+aaL60vhHeFiFQDsq XLu8oPn/bRZpY1hqYkQi5imckin0CusDYVKkPteQv77UCby9+27G1SjQmMnAbnWUwvCxPBB A3zbN3UmjxIy9ubaTNGyVtvqrMqhwVkn9OtEs2WtUyMALvQjAQebRuCdDojzbZg4yGxZHUq SGn8bxa2v7pya8ow1bTaQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:RBvFEct2LWc=:eGPkPLCFLqPVTr3QfjSfMl t/Q7etKKPYGlz+bdhntANIH2lE8QA3A9XbsS2Gscae5UbQ/MkLKEQbA+vboRcLGYWQ8RsCTie bARUR6Ew1wlXaMHiVmZPbunuvr3mOnCaaeO6k4ntnewAin1UHA++MHmStoCg35hyld5sckhFz ISKXiShGaiHfIJ4ERrXDK+gg3jhtay/LkIRYh+Vz28/ApLyybx9hQZUY6uKOgBw/2w/LVLLdd biLMFF2wGdgKTfai1E4cLcaoy9Cqvs0+zFYkEmP4XU2QGhu0P2b60/o+J1wbQypPw17GfmeGO nXQ/eo0Exxt31rAyxky94uM0naWVa+tW8/4HEu2CGow1xvwVfOmAkhxEcjy8sQiIQofKB4ZJX M6pqg2dNUuQQehpymzMhuUgfxIr3jvLdY4bPtdHVM6962tgumWQGqbrYBUUUUfTkPkA2APC1C 1d+Pe7jQQsjOemsvtA+U5ykiZISOSVbB4pGZ9lX+Fz4cd6RxBS6dG5xHQBWVl1rDzxKnsvimm Gt3bgFZM+/VYyQ2y9BQDhzeTMJH9DKtsNPSvWJHIjZ7C63iSaq6+Ey8r3u/Zn97DTeyNRUgAu 0zaSI72mvJF8Yxf6lq6ATU1GXxWdz3zQ41HXLXnAJokzSBVyv5UcE27s6td9IGYxSNlYQNk8v pYYcXk3Us22QPucCyJmi1k0tlDrRyQCJYAavkpQwir+7GD7Tq1WrdwqPyukPxrJgZDMw= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1261 Lines: 33 gcc-7 notices that the length we pass to strncat is wrong: drivers/firmware/ti_sci.c: In function 'ti_sci_probe': drivers/firmware/ti_sci.c:204:32: error: specified bound 50 equals the size of the destination [-Werror=stringop-overflow=] Instead of the total length, we must pass the length of the remaining space here. Fixes: aa276781a64a ("firmware: Add basic support for TI System Control Interface (TI-SCI) protocol") Acked-by: Nishanth Menon Signed-off-by: Arnd Bergmann --- Originally submitted on Jan 11, patch is still needed on Linux-4.11-rc2. --- drivers/firmware/ti_sci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 874ff32db366..00cfed3c3e1a 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -202,7 +202,8 @@ static int ti_sci_debugfs_create(struct platform_device *pdev, info->debug_buffer[info->debug_region_size] = 0; info->d = debugfs_create_file(strncat(debug_name, dev_name(dev), - sizeof(debug_name)), + sizeof(debug_name) - + sizeof("ti_sci_debug@")), 0444, NULL, info, &ti_sci_debug_fops); if (IS_ERR(info->d)) return PTR_ERR(info->d); -- 2.9.0