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: 1979521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=FHHNSaGQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-tegra+bounces-3590-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WxyjG1jt9z1ygC for ; Mon, 2 Sep 2024 15:58:10 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3C8721F224E7 for ; Mon, 2 Sep 2024 05:58:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FA0D153820; Mon, 2 Sep 2024 05:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="FHHNSaGQ" X-Original-To: linux-tegra@vger.kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2057.outbound.protection.outlook.com [40.107.94.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B897B14F100; Mon, 2 Sep 2024 05:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725256684; cv=fail; b=cNDld1W5DQeyjHX21PRp+jMTcM/skIoipI3QbBr1s+FGMmG+xnypIHOc5ipUy6iB5ntfFI1Jf/6MeWdaa+4gzZyHe6fKPw33VSUcx/WI+Z3nad6CNzYiJW4Mh3Q6OtVbquu6l9edy0sw5AOqOpaZMhS4gyhrvxyyyJyRuL9NlGg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725256684; c=relaxed/simple; bh=KDICsT1k1L+QQdL3U7Fz7Vbnv/zvb6zO5TKJCn/sQ2M=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ue3RQnlqMoggTz1ac7PRWCjz34xtuw7oSxWTxQ5SShYQu/DHRmxcpLDrtGAYSd6ArMKN8mPiGa0t3quYGALIIrJV4gUHty8q+AayIBSlnHUWqRneoo9rFkOc2VmrENCzoE8juPNNjKpp17IQrpDICMCakjN5dIWaE67OWxKHUq8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=FHHNSaGQ; arc=fail smtp.client-ip=40.107.94.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com 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 Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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?5Cg3tbjo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yXamDBKfDzifGbAPtbzcKStG+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 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: