From patchwork Mon Sep 2 05:57:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 13786747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBADDCA0ED3 for ; Mon, 2 Sep 2024 06:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=NQI7bKPyyjZD4ONb1cqsRzh9eKQ7GYDoxqPSC0IZybE=; b=fLA16xGK7LJ3JGlOgr1KH7+YMD npawMc7IxTq2pmiF+hANoqo3dORm1EgGlPxYjzRfYZ7h/YVdboFJSsMiueoACUlhafQ2mwogFgIJo Qc/gIFIuDgOIgwpm0SQ5DuToEE2+OZAwtdwKTD23emk776uJP5aCjWaLQNalkDdH9PdtzwaPxPk+J F7wH8SMoaSHjBrb5i4n/W2dOCDqpZlfhX+n/OO/kvxhKKzInWK3YSf0kbwsDHJ4kDDCGtpRGZZwfL 5WL5zBPNx+8V4AxUhTmbZGLamymDUOb0RkfMHmwzb6xNh8JycMEIGFRIVoaly6gM4EN36tf32q/5N YYvW+kMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl0JQ-0000000D7DZ-3ur7; Mon, 02 Sep 2024 06:13:16 +0000 Received: from mail-dm6nam11on20631.outbound.protection.outlook.com ([2a01:111:f403:2415::631] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl0IY-0000000D75u-3JtK for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 06:12:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tp0AvvPauDuIpCLSvW001g1l7s8ja+i0Ra/enRmFbfmjNAOe0BCU6tBaXqh2LTSBCFuXl355QjduscFo3OlcYA6mu2wSUHhui42Lv9DafWpxo6Gtc/LE1S7327k3h3qsdk9MGwhzR1d/kLZ8D+1vo56fCFDqJI+fzhffcZFKpAGxdpk2nP7BVA+nreBgm9wJFkOqcsi+f3kZ0JuzHW2OuUGjvEfCMOZjWpzSPHb2YVQFZVYAbV0T7MssNpsWsRXB8M5EE3L9C1dtO+a20UC/N+cskC2dPXArH1XwGjwePEySjqVQDU+x4Bhu3uRo7deIITHkW+MuPMOimQO5dp71Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NQI7bKPyyjZD4ONb1cqsRzh9eKQ7GYDoxqPSC0IZybE=; b=c8aAshYPaHBXbby9RuF7LGcB8fobPRWCV/WjXbDx2kyohDnR0EFzi2buQfzcRCyBeotov3XxsAonj0OGYOaaN/h7aOQyu2saN0MwvRn2ALH1NKywqSiS9vDbF4YJt0oKO/N6vOtgLQBq4RLiKOVfNyP0g0kbWyZO+NTgjxEDB+mC27w4XOkuaoz63C6ZE8N27XulH5PGs7QuBmwk2zX18Zd3dyVopOrHyfYPXsWTpXSuVKelrKitMZTuDlwP7cOoe/VvQ7WQteuhS8R6V6V1OsMB7UYcHPQZ297oP973GH4jIqBRHHWt/yoTNqlmGEo4qVW/EGwBeupP6wLtcAVqtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NQI7bKPyyjZD4ONb1cqsRzh9eKQ7GYDoxqPSC0IZybE=; b=FHHNSaGQDdxMTImEZvCKJ6NmQjcMc0vbtih8hoAo/g7Ini/mEBkTRH4RMRu7Dk4AJmbx8L8z2iPT750lzgc1BHMfYJ1J0+PxEh96jMyDLY6KS7rDnjLRCM+ODqrVLetNL8hxZqFZP2QW0z1wbEowpyKYXx2LSa8SsnqT6iRK0vpsvRwSyCk3eoPx3r1YvNGMox48+BDSDll990su+BU+P7Aa1IX0ak7LNPCDXIl4m28DhQQSpX75Tz2OfsjkqWaKS7r5sLNu1M+vMWn4/bBARHM6spsDpmXD1HOXDTCEDcYqtXl62OmNEeL6X+3nNtjNLq2CN7mvDc67ZX5MeQm0KA== Received: from BN0PR04CA0056.namprd04.prod.outlook.com (2603:10b6:408:e8::31) by BY5PR12MB4212.namprd12.prod.outlook.com (2603:10b6:a03:202::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.22; Mon, 2 Sep 2024 05:57:58 +0000 Received: from BN3PEPF0000B370.namprd21.prod.outlook.com (2603:10b6:408:e8:cafe::51) by BN0PR04CA0056.outlook.office365.com (2603:10b6:408:e8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24 via Frontend Transport; Mon, 2 Sep 2024 05:57:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN3PEPF0000B370.mail.protection.outlook.com (10.167.243.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.2 via Frontend Transport; Mon, 2 Sep 2024 05:57:57 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 1 Sep 2024 22:57:54 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 1 Sep 2024 22:57:53 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sun, 1 Sep 2024 22:57:53 -0700 From: Nicolin Chen To: CC: , , , , , , , , , Subject: [PATCH] iommu/tegra241-cmdqv: Fix -Wformat-truncation warnings in lvcmdq_error_header Date: Sun, 1 Sep 2024 22:57:45 -0700 Message-ID: <20240902055745.629456-1-nicolinc@nvidia.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B370:EE_|BY5PR12MB4212:EE_ X-MS-Office365-Filtering-Correlation-Id: c7982b39-12e1-45a9-1d49-08dccb143205 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?a2ig9xmUeqPI3XbliMw6JwKZkASTnXJ?= =?utf-8?q?5Cg3tbjoybgTXWYf6lvuc4XjDMZZBpKZDpUYbRP7n/O7Ma1uRF94hyIOiWNHlb5rI?= =?utf-8?q?Fbp9zUWmSRhIwigHFB3ozLSwb4oVzS8+chzJtgOXt0UzkX6cFWyRyCVNGLFi4IKyb?= =?utf-8?q?rWT3ZqzCOzZlI1OhpZQrcIFPT852W//HL4T7K17qmOh6W4dwV2xKj11jpn+Ay6amA?= =?utf-8?q?KJ30OyK57Pfulp8qc2yIuYHhzlRRZZD88AK8oNlNQTnxpTcMJrosKjld4eNFRfan0?= =?utf-8?q?3JRlWu4OwxJ7fG7sfSIifDNgXnmyKF2IPysQfz9q8500XRp4sN8YEn6Yxm7qprzIy?= =?utf-8?q?XMKiv2SqgZD1ylTxx5o9fzOiNV0LJZNuG9pU1E/SBIoGcFLwtk3bvyiIXA9YlouFe?= =?utf-8?q?AT9/1zsJ3/rlkEP2PidHwVLGJKdUIKyUHRJwNBVo89JHW8oVkSB1zqBTn1UpWCpIe?= =?utf-8?q?0zpjvAY7H+9/R3nvLc5hdwbDyMMhBU2gqBE4g909YuTFzRO7MEUXAWD/MvNEVt3Va?= =?utf-8?q?FSGxIlEatBWS0/pKcKN5aLPijKN3cgKcEQ3fgZZ531weU0mYAyL2+4XlQbNcKIZmL?= =?utf-8?q?CcPYdTN7V2UB/COK7sOJU+QPlFJTJEJwFs9E0nLAPN+8Bn1sdTiTIs/+kK3D9j79k?= =?utf-8?q?VCh9vD1vwV+TpCRso9JTPvjy5adHI5FSdjirDnsHKRyk0y+pAj2qQdA900HTAURI1?= =?utf-8?q?5029nYcxpwZSBQ6ONN951Mm9AJt2Dek2L2yymzCrK09Ch3vsFi1JIlC4lyYHd7hKr?= =?utf-8?q?V6dmXj6a9ZFk9FaI4erJSUVrFxsOw/TvxZCNkGPhhl3xtFouK01jR+v5FYPwR+7Tg?= =?utf-8?q?QoCmtVn+A7dRco8ZTqcNkxiYLwQ4vycImcOzQmh7ivdF6FzxAb4LeWEcjiiXvrtvU?= =?utf-8?q?PyXamDBKfDzifGbAPtbzcKStG+RDHSGP3t7GV2paYoO/toAgc3WCyTJbH9isvbpMq?= =?utf-8?q?iQQWJ10CzqUB2RGvvUeMeAAKuBT9PnBfdeOKI8Nyx7O8mVtefBe1IyDnvEQSjvZpP?= =?utf-8?q?va74tgUmhDjZZNuulbvJh6n5khBuEFAf4Y+vPgC9HhhZ3VQ6YVqyLrDbhYCL+i/ao?= =?utf-8?q?mtqI83N5zF8znmiUKFZ9SPGRd/VeLOgMj2GYPV3NBg9K6clX0O03ClTaly55O1qHS?= =?utf-8?q?rvN/a4eN2a8wto+nc5QedaxDfdxvJ9IVc7PNBrGiNn+zYK1A2h1Au8sQuMDiMsZcx?= =?utf-8?q?enr4dMZOI2NO6pb4NQFA2SH0eG7JZsFN91/FUt5Q7CRL/GaUD2osXCHvabwv235gw?= =?utf-8?q?LilwyJ29ueexI4HC+Wtr5FSaa0jBxsSkWY7ypvAt4/AVlPLfgWwfIXF8IeMoKSpBj?= =?utf-8?q?kl+nyw1+4oo5yO3xkZISdPtnr1PI1kGU3rAgvWzLoMZLpN+ztU9gjkrUdc17pJj80?= =?utf-8?q?Gz1C8ECTP08?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2024 05:57:57.6716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7982b39-12e1-45a9-1d49-08dccb143205 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B370.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4212 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240901_231222_847274_AC75C288 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Kernel test robot reported a few trucation warnings at the snprintf: drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c: In function ‘tegra241_vintf_free_lvcmdq’: drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c:239:56: warning: ‘%u’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 3 and 11 [-Wformat-truncation=] 239 | snprintf(header, hlen, "VINTF%u: VCMDQ%u/LVCMDQ%u: ", | ^~ drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c:239:32: note: directive argument in the range [0, 65535] 239 | snprintf(header, hlen, "VINTF%u: VCMDQ%u/LVCMDQ%u: ", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c:239:9: note: ‘snprintf’ output between 25 and 37 bytes into a destination of size 32 239 | snprintf(header, hlen, "VINTF%u: VCMDQ%u/LVCMDQ%u: ", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | vcmdq->vintf->idx, vcmdq->idx, vcmdq->lidx); Fix by bumping up the size of the header to hold more characters. Fixes: 918eb5c856f6 ("iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202409020406.7ed5uojF-lkp@intel.com/ Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c index 9eb9d959f3e5..03fd13c21dcc 100644 --- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c @@ -233,7 +233,7 @@ static inline int vintf_write_config(struct tegra241_vintf *vintf, u32 regval) static inline char *lvcmdq_error_header(struct tegra241_vcmdq *vcmdq, char *header, int hlen) { - WARN_ON(hlen < 32); + WARN_ON(hlen < 64); if (WARN_ON(!vcmdq->vintf)) return ""; snprintf(header, hlen, "VINTF%u: VCMDQ%u/LVCMDQ%u: ", @@ -243,7 +243,7 @@ static inline char *lvcmdq_error_header(struct tegra241_vcmdq *vcmdq, static inline int vcmdq_write_config(struct tegra241_vcmdq *vcmdq, u32 regval) { - char header[32], *h = lvcmdq_error_header(vcmdq, header, 32); + char header[64], *h = lvcmdq_error_header(vcmdq, header, 64); return tegra241_cmdqv_write_config(vcmdq->cmdqv, REG_VCMDQ_PAGE0(vcmdq, CONFIG), @@ -354,7 +354,7 @@ tegra241_cmdqv_get_cmdq(struct arm_smmu_device *smmu, static void tegra241_vcmdq_hw_deinit(struct tegra241_vcmdq *vcmdq) { - char header[32], *h = lvcmdq_error_header(vcmdq, header, 32); + char header[64], *h = lvcmdq_error_header(vcmdq, header, 64); u32 gerrorn, gerror; if (vcmdq_write_config(vcmdq, 0)) { @@ -382,7 +382,7 @@ static void tegra241_vcmdq_hw_deinit(struct tegra241_vcmdq *vcmdq) static int tegra241_vcmdq_hw_init(struct tegra241_vcmdq *vcmdq) { - char header[32], *h = lvcmdq_error_header(vcmdq, header, 32); + char header[64], *h = lvcmdq_error_header(vcmdq, header, 64); int ret; /* Reset VCMDQ */ @@ -555,13 +555,13 @@ static int tegra241_vintf_init_lvcmdq(struct tegra241_vintf *vintf, u16 lidx, static void tegra241_vintf_free_lvcmdq(struct tegra241_vintf *vintf, u16 lidx) { struct tegra241_vcmdq *vcmdq = vintf->lvcmdqs[lidx]; - char header[32]; + char header[64]; tegra241_vcmdq_free_smmu_cmdq(vcmdq); tegra241_vintf_deinit_lvcmdq(vintf, lidx); dev_dbg(vintf->cmdqv->dev, - "%sdeallocated\n", lvcmdq_error_header(vcmdq, header, 32)); + "%sdeallocated\n", lvcmdq_error_header(vcmdq, header, 64)); kfree(vcmdq); } @@ -570,7 +570,7 @@ tegra241_vintf_alloc_lvcmdq(struct tegra241_vintf *vintf, u16 lidx) { struct tegra241_cmdqv *cmdqv = vintf->cmdqv; struct tegra241_vcmdq *vcmdq; - char header[32]; + char header[64]; int ret; vcmdq = kzalloc(sizeof(*vcmdq), GFP_KERNEL); @@ -587,7 +587,7 @@ tegra241_vintf_alloc_lvcmdq(struct tegra241_vintf *vintf, u16 lidx) goto deinit_lvcmdq; dev_dbg(cmdqv->dev, - "%sallocated\n", lvcmdq_error_header(vcmdq, header, 32)); + "%sallocated\n", lvcmdq_error_header(vcmdq, header, 64)); return vcmdq; deinit_lvcmdq: