From patchwork Fri Jul 14 12:07:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107790 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp891189obm; Fri, 14 Jul 2017 05:12:18 -0700 (PDT) X-Received: by 10.99.115.66 with SMTP id d2mr14656723pgn.10.1500034337921; Fri, 14 Jul 2017 05:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500034337; cv=none; d=google.com; s=arc-20160816; b=APFwk/4qmcQWnls9xmE/YMprWv1I+ip/r7P/g3B+fNppOIQ4zJX/PCh5iqUar7xZEg oKdR8xDNQbzye2gjIOD20VCTzgBGtbvNx6IkCrOmgSHPoonZEsXC1Re1/1wS2iB4c7H5 fGW8tF4C+E1hriXXgJYsYzfvavdIgGP1EOK87YqTRIOAKV5z5NFTxwCErULGvSeHuX87 R0ED9LBJb55/gTPe49yKvPJn02QALEn59I4RDaFNtkwvb8erDaY51kZvPX7LeawoSJey d8zj9LqyrEmu84OM4mqKHxBJSrMDlAE0N6rzPltbTwlDpE9dS16n80vGohKTeHRvcUpe /zvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=U6nrofor5p0DmjbRqpHY+xiMblZVGXyuBmUDDbWOFFs=; b=bO/+7uvB4H8P1BcLg+seporz0Z94/qaXu0ulrebQiPgniZ3ddlU5msrUaAXc9FY/wQ qbVVVYHNI7a5ZnjFP2oYgA8kNZmYy8czLdpSPTFc9mkQ95xI9SuhZXcG5Op0cxFhkWaS /S8uZiZxzhpeJkOhhRh3yZE8VOd9vh2YYzSZe/LVinOgbW4A9kl3PQ+Ye+FYsSBN0X9c PVdcz3/9rKCtjnWDbWeRtSbMRzNFvzgnRmPweiBW3uwm5Fc4tjEp4JzRpue+G/YKlbkY ebgtYknDvv7l2wqSBBlSTFsizpzCwvsZXx2L6BjbkcKFzQJISfkpTyxWDvWZ6WrPix5c Fk0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si6730523plb.307.2017.07.14.05.12.17; Fri, 14 Jul 2017 05:12:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754224AbdGNMMF (ORCPT + 25 others); Fri, 14 Jul 2017 08:12:05 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:51173 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751392AbdGNMMC (ORCPT ); Fri, 14 Jul 2017 08:12:02 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lucpk-1degZJ0h96-00zkIB; Fri, 14 Jul 2017 14:10:13 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Sunil Goutham , Robert Richter Cc: Greg Kroah-Hartman , Linus Torvalds , Guenter Roeck , akpm@linux-foundation.org, netdev@vger.kernel.org, "David S . Miller" , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, x86@kernel.org, Arnd Bergmann , Thanneeru Srinivasulu , George Cherian , Vadim Lomovtsev , Radha Mohan Chintakuntla , linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/22] net: thunder_bgx: avoid format string overflow warning Date: Fri, 14 Jul 2017 14:07:03 +0200 Message-Id: <20170714120720.906842-12-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714120720.906842-1-arnd@arndb.de> References: <20170714120720.906842-1-arnd@arndb.de> X-Provags-ID: V03:K0:IXkVdlkrGd4gRR1l004nsDZDHsJCZogj8lLqo+ket4PT6i6j4So ZrlGb0Lr7KjpTnAvHSl3UvfR89sScvb8u8sfyrOCckH9h6m5pNvnncQOQ22udefMgXWXYLq B9htEtP8y6kI3GVn9qnXa/YfSDBviYY+azRwOaEQdEYnhhvf+5CFwWY0FWurl8Woe/sf1hd GPimPSFvBH2YKGR+Ta/HQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xI/tuusgwSs=:HZEowIDYy7v5MokrN/z9d4 +fflzhBCSBCtiZ872Qoio+eraYz5hNSszhppDpNKndvmZXHkHyPnEF4zKkVr4jDWSkPFnjbBs 3nHfbUa2JhGW/wA42qEWX5ph97iwtzXy3fx7bbl+xVnVdVpg8m1jg0P0wVdRu8w9p6mHGK/zb hceCjGMHXJ5VJM5pLtF1B6KX/sTVHh/VG5RoKm+TI6Q51WcnA9uS+GfaDDmptgTrq2ASq8twd FSokNWOU38U9elPUuH02Tp8R6l9fTct96obJTPGrm64T6uIVQ3fdWsxd5ymkH+dT4ZULnLtBM DS3FaveCRlv7YFtXE+4Gy8qBzsK+S3A97/qr5VASnaKX9pY5kPvt01yQNLWd8t9S7YkGG1hho anuloYgQiEhZVosCzSP1EtKON9jZq+Dj10SmXEcNovGJZeP3ROd1UrAra5iyc+dHyrQqwAtWv VcBk+h09NcI4d4EYdjwcdlapleCkl3ulVxVHQC4tbbSKH/Ktz7DYa3iJIHR8mLXHl/IM9wLo8 pENknVXsfrc1KGoE6s6INnfldtc+fxFUdpv1qUYZRQBVpbt0TK60UEkjrFf3zupuWp0F18PbB OvdrBzAKkNPSX3v4jmK99aO86dHvaBsaKxf2KGHobdxCiLcdFcXSkVR1y5F+xLCMY9v79lYUr SdfZJTnNcQI0+xZkRn4d/UYf1fVeJI4SLCOwrn0tAv6bz5jT71/9EAWYA8azHsWRMKWuPo6UW Gf0GFi3n8nUP5Kc+bscabBYF84FaIkgN7fhvzg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc warns that the temporary buffer might be too small here: drivers/net/ethernet/cavium/thunder/thunder_bgx.c: In function 'bgx_probe': drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1020:16: error: '%d' directive writing between 1 and 10 bytes into a region of size between 9 and 11 [-Werror=format-overflow=] sprintf(str, "BGX%d LMAC%d mode", bgx->bgx_id, lmacid); ^~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1020:16: note: directive argument in the range [0, 2147483647] drivers/net/ethernet/cavium/thunder/thunder_bgx.c:1020:3: note: 'sprintf' output between 16 and 27 bytes into a destination of size 20 This probably can't happen, but it can't hurt to make it long enough for the theoretical limit. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index a0ca68ce3fbb..79112563a25a 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -1008,7 +1008,7 @@ static void bgx_print_qlm_mode(struct bgx *bgx, u8 lmacid) { struct device *dev = &bgx->pdev->dev; struct lmac *lmac; - char str[20]; + char str[27]; if (!bgx->is_dlm && lmacid) return;