From patchwork Thu Sep 24 17:38:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loc Ho X-Patchwork-Id: 7259631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 49699BEEC1 for ; Thu, 24 Sep 2015 17:40:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6ED9C20812 for ; Thu, 24 Sep 2015 17:40:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72C3F20A2A for ; Thu, 24 Sep 2015 17:40:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfATt-00049W-S9; Thu, 24 Sep 2015 17:38:53 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfATq-00041r-S3 for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2015 17:38:51 +0000 Received: by padhy16 with SMTP id hy16so79037264pad.1 for ; Thu, 24 Sep 2015 10:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=pS6QhtjnLlfmo6E27HMoOi/mK+pVt6s+2CqZPp5p9f0=; b=a8IDgE3tcVRktPLqgao9zlCWcH6u98pXW/O8PuVzmSJtkxQBSPQjhgDwgEk/eOYusH hl7/sFW0zT27I0fei9cchs3bi/m7XyOiDSuEIStSWNOgNf4FAtK3rdtz4WahZ2a9xiCP UvB5jQPIGDiWsKSUHDsClfmIWdx4lHJdwe8cs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pS6QhtjnLlfmo6E27HMoOi/mK+pVt6s+2CqZPp5p9f0=; b=ec3hwQYSEjjDWmJXLi869a1ZJA8aEZ90Ry1omI3yLiN6LRJWihOy+nhsDCCXR+NmyW i1B2XI59qb3B0l8D2oXmc5tbPggR1tX+2ERAVIXDQohp2blqNpAdwvE1IDb5BA6uHABZ 8WWr6iS0t9V8SB8abTytDg0nSAre3y5e3F8vMDqSIA9PJDbwjGZAqPaMi5Bg/yNNZYZh Jz2aWqnmMO26rUVsJxiLccaSTyZUjoHw3NWszYg8BLkyDtiDNCHs3x401HLVF1GnsduA Sat7og3j63t53lGx5R/wQd2EXOo0t8+KgzhfL1m1TmPRJcu6COBdqD4WgThsAbQyaglU J1Xw== X-Gm-Message-State: ALoCoQnPdaceoUkqbDZHIEG30qBWQ7XUuajehp7bCHF3qXTc998RzfFX+jCsWgIOqmx6jUI0k99m X-Received: by 10.68.204.65 with SMTP id kw1mr1096087pbc.76.1443116309896; Thu, 24 Sep 2015 10:38:29 -0700 (PDT) Received: from sdclab92.localdomain (70-35-53-82.static.wiline.com. [70.35.53.82]) by smtp.gmail.com with ESMTPSA id rw8sm10338114pac.11.2015.09.24.10.38.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 10:38:28 -0700 (PDT) From: Loc Ho To: dougthompson@xmission.com, bp@alien8.de, mchehab@osg.samsung.com, arnd@arndb.de Subject: [PATCH] edac: xgene: Fix possible sprintf overflow issue Date: Thu, 24 Sep 2015 10:38:07 -0700 Message-Id: <1443116287-11752-1-git-send-email-lho@apm.com> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150924_103850_937709_27E362B1 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, ijc+devicetree@hellion.org.uk, jcm@redhat.com, patches@apm.com, robh+dt@kernel.org, Loc Ho , linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace sprintf with snprintf to avoid possible string array overflow. Signed-off-by: Loc Ho --- drivers/edac/xgene_edac.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c index 37121e8..dfa13bb 100644 --- a/drivers/edac/xgene_edac.c +++ b/drivers/edac/xgene_edac.c @@ -879,7 +879,7 @@ xgene_edac_pmd_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev) if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs) return; - sprintf(name, "PMD%d", ctx->pmd); + snprintf(name, sizeof(name), "PMD%d", ctx->pmd); dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs); if (!dbgfs_dir) return; @@ -923,7 +923,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np, goto err_group; } - sprintf(edac_name, "l2c%d", pmd); + snprintf(edac_name, sizeof(edac_name), "l2c%d", pmd); edac_dev = edac_device_alloc_ctl_info(sizeof(*ctx), edac_name, 1, "l2c", 1, 2, NULL, 0, edac_device_alloc_index()); @@ -1183,7 +1183,7 @@ xgene_edac_l3_create_debugfs_nodes(struct edac_device_ctl_info *edac_dev) if (!IS_ENABLED(CONFIG_EDAC_DEBUG) || !ctx->edac->dfs) return; - sprintf(name, "l3c%d", ctx->edac_idx); + snprintf(name, sizeof(name), "l3c%d", ctx->edac_idx); dbgfs_dir = edac_debugfs_create_dir_at(name, ctx->edac->dfs); if (!dbgfs_dir) return;