Skip to contentSkip to conversation

crypto: qat - increase size of buffers

PATCH In review Giovanni Cabiddu 2 participants 2 messages Sep 22, 2023 – Oct 1, 2023

Subsystems (2)
lore
Share & tools
lore

Giovanni Cabiddu

author maintainer
#0 lore raw

PATCH 1/1 crypto: qat - increase size of buffers

Increase the size of the buffers used for composing the names used for the transport debugfs entries and the vector name to avoid a potential truncation.

This resolves the following errors when compiling the driver with W=1 and KCFLAGS=-Werror on GCC 12.3.1:

drivers/crypto/intel/qat/qat_common/adf_transport_debug.c: In function ‘adf_ring_debugfs_add’:
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c:100:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] drivers/crypto/intel/qat/qat_common/adf_isr.c: In function ‘adf_isr_resource_alloc’:
drivers/crypto/intel/qat/qat_common/adf_isr.c:197:47: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 5 [-Werror=format-truncation=]

Fixes a672a9dc872e ("crypto: qat - Intel(R) QAT transport code")
---
 drivers/crypto/intel/qat/qat_common/adf_accel_devices.h   | 2 +-
 drivers/crypto/intel/qat/qat_common/adf_transport_debug.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_accel_devices.h +1 -1
index e57abde66f4f..1e84ff309ed3 100644
@@ -29,7 +29,7 @@
 #define ADF_PCI_MAX_BARS 3
 #define ADF_DEVICE_NAME_LENGTH 32
 #define ADF_ETR_MAX_RINGS_PER_BANK 16
-#define ADF_MAX_MSIX_VECTOR_NAME 16
+#define ADF_MAX_MSIX_VECTOR_NAME 48
 #define ADF_DEVICE_NAME_PREFIX "qat_"
 
 enum adf_accel_capabilities {
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c +2 -2
index 08bca1c506c0..e2dd568b87b5 100644
@@ -90,7 +90,7 @@ DEFINE_SEQ_ATTRIBUTE(adf_ring_debug);
 int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name)
 {
 	struct adf_etr_ring_debug_entry *ring_debug;
-	char entry_name[8];
+	char entry_name[16];
 
 	ring_debug = kzalloc(sizeof(*ring_debug), GFP_KERNEL);
 	if (!ring_debug)
@@ -192,7 +192,7 @@ int adf_bank_debugfs_add(struct adf_etr_bank_data *bank)
 {
 	struct adf_accel_dev *accel_dev = bank->accel_dev;
 	struct dentry *parent = accel_dev->transport->debug;
-	char name[8];
+	char name[16];
 
 	snprintf(name, sizeof(name), "bank_%02d", bank->bank_number);
 	bank->bank_debug_dir = debugfs_create_dir(name, parent);

base-commit: edcadf3e2fec2d0512a61273e130a53fc19c501a

Signature · 1 line
2.41.0
maintainer
#1 lore raw
Quoted 12 lines · Giovanni Cabiddu

Increase the size of the buffers used for composing the names used for the transport debugfs entries and the vector name to avoid a potential truncation.

This resolves the following errors when compiling the driver with W=1 and KCFLAGS=-Werror on GCC 12.3.1:

drivers/crypto/intel/qat/qat_common/adf_transport_debug.c: In function ‘adf_ring_debugfs_add’:
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c:100:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] drivers/crypto/intel/qat/qat_common/adf_isr.c: In function ‘adf_isr_resource_alloc’:
drivers/crypto/intel/qat/qat_common/adf_isr.c:197:47: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 5 [-Werror=format-truncation=]

Quoted 7 lines
Fixes a672a9dc872e ("crypto: qat - Intel(R) QAT transport code")
---
 drivers/crypto/intel/qat/qat_common/adf_accel_devices.h   | 2 +-
 drivers/crypto/intel/qat/qat_common/adf_transport_debug.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt