From patchwork Thu May 23 15:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13672009 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 66DBCE54C for ; Thu, 23 May 2024 15:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479483; cv=none; b=C9HB1Z1JrHWlDEQtTnc+PozXRpzpa/IaXujF9Z6+/AilLsL2LWmWEzFl0b93Iy2Mem7USW8+n6d2Zt3d1QdLbMwUvWHwhAbvPyueMHB2od7PpnNqPINnHOyAOlOcPWRv7CcuHXrxJcsCnj+WnSGL3wq834wKwhUcpCYa01KgI74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479483; c=relaxed/simple; bh=KFEqUVe6krk9OGtuAsBTyaSZZ/QIyp0OxOs/kRFPd2Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=NVEYQnFikeA8LFgYWpb3mnQbhMKr1rvE0F4QN/kOEBxJQn9NJhv8jSChHETq1bwhrLLtNzm5OpNLE11+jKPCeGjg6uCvqggQ9aK6+AQOeAvKAJQ0EAepuupaXTtxHU0J2OcPSlzFl/v6PBOeid2sFgV5DFxmB/vbOVDmFgWYkM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HHxS73JO; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HHxS73JO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716479482; x=1748015482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KFEqUVe6krk9OGtuAsBTyaSZZ/QIyp0OxOs/kRFPd2Q=; b=HHxS73JOUlonBka8VScGXDdJnhy3m5bW235mXXeKEle8x4DCo4xswa/T 9AyavjZUhY4vlDsvHU2QoaEXddPucyCntAq0Tyh1Rq0TJgcQdXOn2VhdA QqMi/lIx9w0JXzq2i5GbawvMbfNsXz2h9HC6+kz5ZPGx2HQf9PrTvwJJd j4q9UNOIcmDCHM3nM2IH0I3Nsa649Tc3KeiuTvUNA0Da3h7heEayTHZot 4dFiWZGdBczfOxg3tkFlA9qvW/h8llvJLVWpJ1dDyeoPwNg1qFp3hNWYs LtN6QgJ4ekkPSHJ7SOFYGfPWeCX6gl1LGVRVGpL3CkQjeokBfmqwsIbmr Q==; X-CSE-ConnectionGUID: lfo9MLodRAWeT9ZLkDDdeQ== X-CSE-MsgGUID: v9YkkxE8QP2nY6tXYfHaxQ== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="12982296" X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="12982296" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:21 -0700 X-CSE-ConnectionGUID: hNSDpPw8Q12d8KM0nWxpHQ== X-CSE-MsgGUID: GDJ3T2FGRTuYefEhWUQ1eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="38556335" Received: from unknown (HELO localhost) ([10.237.66.160]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:19 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org, imx@lists.linux.dev, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Pan Xinhui Subject: [PATCH 1/4] drm/amdgpu: fix -Wformat-truncation warning in amdgpu_gfx_kiq_init_ring() Date: Thu, 23 May 2024 18:51:06 +0300 Message-Id: <4b9ca4a1bd8e77f2d9b912b4af5d4fbdec13e801.1716479340.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Enabling -Wformat-truncation yields the following warning: ../drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function ‘amdgpu_gfx_kiq_init_ring’: ../drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:61: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 8 [-Werror=format-truncation=] 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", | ^~ ../drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:50: note: directive argument in the range [0, 2147483647] 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", | ^~~~~~~~~~~~~~~~~ ../drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:9: note: ‘snprintf’ output between 12 and 41 bytes into a destination of size 16 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | xcc_id, ring->me, ring->pipe, ring->queue); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Silence the warning by checking the snprintf() return value. Signed-off-by: Jani Nikula --- Cc: Alex Deucher Cc: "Christian König" Cc: Pan Xinhui Cc: amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index 1d955652f3ba..92744d0d2c10 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -329,8 +329,10 @@ int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, int xcc_id) ring->eop_gpu_addr = kiq->eop_gpu_addr; ring->no_scheduler = true; - snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", - xcc_id, ring->me, ring->pipe, ring->queue); + r = snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", + xcc_id, ring->me, ring->pipe, ring->queue); + if (r >= sizeof(ring->name)) + dev_warn(adev->dev, "kiq ring name truncated\n"); r = amdgpu_ring_init(adev, ring, 1024, irq, AMDGPU_CP_KIQ_IRQ_DRIVER0, AMDGPU_RING_PRIO_DEFAULT, NULL); if (r) From patchwork Thu May 23 15:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13672010 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 DF2C711CA1 for ; Thu, 23 May 2024 15:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479489; cv=none; b=VLeybgQzgIggowZC1wslBxl7wL+pwyQM1zsTdW5cmTt4h12X84p88Mobf2wcqIDCWnSFdjS72HOjRrE/im6n1ST5w5SjL6XacovKs5oCkJ5QBxvAD2WKFfqMghfoGEhlbCAOyJVY5yQ+kWRTBgWZu6RHBiBaw36WEzI7HOnGA+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479489; c=relaxed/simple; bh=LWxOpwsQKaJr2wkzuXxKCrV6aG4OKNoCsg0wjE3wLWw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Jnb0UGHA6DQ0qjKBqCnFMIERrTju384dloG1ZeLD+c57PuLZmKoq6YhTyXuW4OBxr5IGqmjfqLKfcdLQzN4QxEL4CeO+M7HOlMhNd+iVJftz5wzZsAxBk1EXH3pHiN2/PWf5NBnvwfIA9NI0E3/RIihtewxi1E5wWIQX/81XEgw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VyRs39AQ; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VyRs39AQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716479487; x=1748015487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LWxOpwsQKaJr2wkzuXxKCrV6aG4OKNoCsg0wjE3wLWw=; b=VyRs39AQlmEpVfxx7D+T/PPrZnI3+g9VGYT9ec5fPXcZTPybbYutJHE6 klxO/H9W592m+jZeWUsRT1FUG+oMW9z+i2oPA+7mLR6x3jrN8r7XFrSyM YYL8XuvnewDGnkJXIOUy+RcOtVapV86vnn5337C8CQxjCqLDVQ4qWaOEU Y2L4zsvdjzuczotBnzMaTmfoaZE1np2BSnYjzCyqUJJiIB7aBIWTQgXCm eZEEU7wCdBY9/HT0ExaLDEDTzFsxdqe3Hnr+gGr5XQ05w5Erjf8D9CXl0 YoHLsovOjK5ZaiA4OQ0f+ZRgGt0Qxuf5NQ7R8CInzEsPDcqX9C00S7bHY Q==; X-CSE-ConnectionGUID: ydmTMLQTSfioF0j3NDyX5Q== X-CSE-MsgGUID: JLC7eZH5TcyJoUlIIl33yQ== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="16644268" X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="16644268" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:27 -0700 X-CSE-ConnectionGUID: 1zN68PPiQrS29sCHwNf1+Q== X-CSE-MsgGUID: Zr6Hen4NSbeQqED/WtlVTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="34324920" Received: from unknown (HELO localhost) ([10.237.66.160]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:24 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org, imx@lists.linux.dev, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, Karol Herbst , Lyude Paul , Danilo Krummrich Subject: [PATCH 2/4] drm/nouveau: fix -Wformat-truncation warning in nouveau_backlight_init() Date: Thu, 23 May 2024 18:51:07 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Enabling -Wformat-truncation yields the following warning: ../drivers/gpu/drm/nouveau/nouveau_backlight.c: In function ‘nouveau_backlight_init’: ../drivers/gpu/drm/nouveau/nouveau_backlight.c:56:69: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Werror=format-truncation=] 56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); | ^~ In function ‘nouveau_get_backlight_name’, inlined from ‘nouveau_backlight_init’ at ../drivers/gpu/drm/nouveau/nouveau_backlight.c:351:7: ../drivers/gpu/drm/nouveau/nouveau_backlight.c:56:56: note: directive argument in the range [1, 2147483647] 56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); | ^~~~~~~~~~~~~~~~ ../drivers/gpu/drm/nouveau/nouveau_backlight.c:56:17: note: ‘snprintf’ output between 14 and 23 bytes into a destination of size 15 56 | snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Silence the warning by checking the snprintf() return value. Signed-off-by: Jani Nikula --- Cc: Karol Herbst Cc: Lyude Paul Cc: Danilo Krummrich Cc: dri-devel@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org --- drivers/gpu/drm/nouveau/nouveau_backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index d47442125fa1..1d77a5f280c5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -49,13 +49,18 @@ nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE], struct nouveau_backlight *bl) { const int nb = ida_alloc_max(&bl_ida, 99, GFP_KERNEL); + int ret; if (nb < 0) return false; if (nb > 0) - snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); + ret = snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb); else - snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight"); + ret = snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight"); + + if (ret >= BL_NAME_SIZE) + return false; + bl->id = nb; return true; } From patchwork Thu May 23 15:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13672011 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 EF938E54C for ; Thu, 23 May 2024 15:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479498; cv=none; b=NWCDieS9flleCyROviaZbdX8ybURIcYSOMBKeivvb44Uw1OCG5vBQZ/14B2404FWJ6IDBEhGlOoyzEW6a4Hs/65wHsgdLw/Fl1nYX5QkQxcY+CTjt2H9W9MgLOBEDmMY5ZI7+1vCSvxqAx9srhv31HwK7ozyyzkca31m/+xAePU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479498; c=relaxed/simple; bh=9fYv1QeB6WK06AnnzgZ8h5bb4qnXHz4G7xbA7xVKRSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GvTidaYtnt8DGrBxldIXVb8o8k8kvO6fTtwDWuq2TKIKEmq5YcT54AO2vUFghuYoeYgAOcF8hf/Jg+Ygkil9Atfi2UcpP8rFiShEd04hdV5zRxtJYZ966ar3G/DXRTaMq/bY279dpY2jhT0wug6M+dR5jcgP2+09vb3DY1maXPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ilfjOes6; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ilfjOes6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716479494; x=1748015494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9fYv1QeB6WK06AnnzgZ8h5bb4qnXHz4G7xbA7xVKRSA=; b=ilfjOes6mE/PudxpOzaX1UVFnn3kX0+9noxRVllKDHpbDy0hUmZyerJV FtaQ4lHRwIoroRfpFd2Ugpdq08TxcSFciDd3QwcpEV/gCkNO0GQ6YB3Am i+hOcd6/KCEKBrqlEUb/Ceh4+1Xb1gBtoSL5mJ9K8Jf0VgyW57MXUIAid OIppE7JE0TYekAFKXGn4mTfPnexmUo9ikLkRGNSUsFTEkmCV0rU1G//Ms oIMZ8LIJ63SJ1YOKBwBRcUy2j+28AjDY8KDpw1cduqmTKInwpW3pCqYdP FpTp0oLzp1b32nqM74NbzIacS3N+vuEatKuZ/va/B2dDbCnU9o/lEtT/X w==; X-CSE-ConnectionGUID: WQRM4g/kQWKmkEsVMlobtA== X-CSE-MsgGUID: YxLq3vYGSnONjy3wH7R5nw== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="16644300" X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="16644300" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:33 -0700 X-CSE-ConnectionGUID: fw3YigMGQgmGMLtqUIo16g== X-CSE-MsgGUID: 4DkX+wT7R9y6f8dqz8tXNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="34324959" Received: from unknown (HELO localhost) ([10.237.66.160]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:30 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org, imx@lists.linux.dev, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH 3/4] drm/imx: fix -Wformat-truncation warning in imx_ldb_probe() Date: Thu, 23 May 2024 18:51:08 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Enabling -Wformat-truncation yields the following warning: ../drivers/gpu/drm/imx/ipuv3/imx-ldb.c: In function ‘imx_ldb_probe’: ../drivers/gpu/drm/imx/ipuv3/imx-ldb.c:658:57: error: ‘_sel’ directive output may be truncated writing 4 bytes into a region of size between 3 and 13 [-Werror=format-truncation=] 658 | snprintf(clkname, sizeof(clkname), "di%d_sel", i); | ^~~~ ../drivers/gpu/drm/imx/ipuv3/imx-ldb.c:658:17: note: ‘snprintf’ output between 8 and 18 bytes into a destination of size 16 658 | snprintf(clkname, sizeof(clkname), "di%d_sel", i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Silence the warning by checking the snprintf() return value. Signed-off-by: Jani Nikula --- Cc: Philipp Zabel Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: dri-devel@lists.freedesktop.org Cc: imx@lists.linux.dev --- drivers/gpu/drm/imx/ipuv3/imx-ldb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c index 71d70194fcbd..46f779fe60ee 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c @@ -654,8 +654,12 @@ static int imx_ldb_probe(struct platform_device *pdev) */ for (i = 0; i < 4; i++) { char clkname[16]; + int len; + + len = snprintf(clkname, sizeof(clkname), "di%d_sel", i); + if (len >= sizeof(clkname)) + dev_err(dev, "clkname truncated\n"); - snprintf(clkname, sizeof(clkname), "di%d_sel", i); imx_ldb->clk_sel[i] = devm_clk_get(imx_ldb->dev, clkname); if (IS_ERR(imx_ldb->clk_sel[i])) { ret = PTR_ERR(imx_ldb->clk_sel[i]); From patchwork Thu May 23 15:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13672012 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 58E60E54C for ; Thu, 23 May 2024 15:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479501; cv=none; b=TZ7b0r4uL9f2FBNF5rqvH9bnmwCf3EoFTelZGZbvMv1qOZqdTipSzNr8Mlu86UxPoEVAwIcLl4aYLf2mRzEjn+KTSLdAHlSfEyLKV5xxCJo7QM+eEyeeIypUSVj+0k4340+/ZNwT+SZaIytwtNZVWZUtEL9qxfCkUGrPjJK2tT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479501; c=relaxed/simple; bh=u5C+G2r6BRqBl+StF3Q+wwcxgy8yjkrFhSiEp0mdUyQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NKvwgRKeeujmxHPgydolYBUYsD4cOlKi47K0JtOQsgQLABtaW4f1/Uw+c6FIVOU7BeNCxoBvkjdb6tHG9LaEMzkZGs+QWqcq8akAQmsPOeonzsfnFl5S1sb2Ftp/qCh2QX6ghVswNqBcqnOg3EbkGLE/JUCZNmK47a/ARleGx8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FhLAyRfY; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FhLAyRfY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716479499; x=1748015499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u5C+G2r6BRqBl+StF3Q+wwcxgy8yjkrFhSiEp0mdUyQ=; b=FhLAyRfYcGLNrijnvci3lHizjBgvzBQkOheD8IeZFLQm9A7nc0GcPM4z o2EghryF1W45f5xWN/pzvHRYbX2Pjr+VPQog13xBj6EIsLZcnCtdKt+U4 Xqe+k3BjVyB09xUGU4ccaR5jrkE58YaEoN5VG6s45niog4rTLiVrcqyYi GQkRovjyVLwFJCu3/UVbGn/dBTtBupUM+qmbkkfMT+QdTU0QhUhK0vI0x Y6k+6yexIQL/SkkE6tntKGGY89rAj8nK7Te2aXP984ujvbQxnim1e2nz+ Eh6IbmeW7bvS9fhz7z9vBfhIUHuycCKyXmI2MJCt68/CFF9raNZeDFQMx A==; X-CSE-ConnectionGUID: FqmxAS6DS4a+xoTgGUsuCg== X-CSE-MsgGUID: AFcJwrbtSpmSKyA18NguLw== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="12982340" X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="12982340" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:39 -0700 X-CSE-ConnectionGUID: tRe+GP46QGeClIHEEwEkdg== X-CSE-MsgGUID: zjUvqLI3RnCT8irAol/ZKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,183,1712646000"; d="scan'208";a="38556571" Received: from unknown (HELO localhost) ([10.237.66.160]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 08:51:38 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org, imx@lists.linux.dev, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com Subject: [PATCH 4/4] drm: enable -Wformat-truncation across the subsystem Date: Thu, 23 May 2024 18:51:09 +0300 Message-Id: <719debc351075abc36b2573266bfd4d963361e40.1716479340.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo With the -Wformat-truncation warnings fixed, finish the job started in commit a61ddb4393ad ("drm: enable (most) W=1 warnings by default across the subsystem"), and enable that warning too. Signed-off-by: Jani Nikula --- Gut feeling says there are more issues, and my configs just don't catch them all, but let's see what the build bots have to say. ;) --- drivers/gpu/drm/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 68cc9258ffc4..644613dbedda 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -16,8 +16,7 @@ subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable) subdir-ccflags-y += $(call cc-option, -Wunused-const-variable) subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned) subdir-ccflags-y += $(call cc-option, -Wformat-overflow) -# FIXME: fix -Wformat-truncation warnings and uncomment -#subdir-ccflags-y += $(call cc-option, -Wformat-truncation) +subdir-ccflags-y += $(call cc-option, -Wformat-truncation) subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) # The following turn off the warnings enabled by -Wextra ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)