Commit 6d8bac09 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Joerg Roedel
Browse files

iommu/vt-d: Increase buffer size for device name



GCC is not happy with the current code, e.g.:

.../iommu/intel/dmar.c:1063:9: note: ‘sprintf’ output between 6 and 15 bytes into a destination of size 13
 1063 |         sprintf(iommu->name, "dmar%d", iommu->seq_id);

When `make W=1` is supplied, this prevents kernel building. Fix it by
increasing the buffer size for device name and use sizeoF() instead of
hard coded constants.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20241014104529.4025937-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 2a323093
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1060,7 +1060,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
		err = iommu->seq_id;
		goto error;
	}
	sprintf(iommu->name, "dmar%d", iommu->seq_id);
	snprintf(iommu->name, sizeof(iommu->name), "dmar%d", iommu->seq_id);

	err = map_iommu(iommu, drhd);
	if (err) {
+1 −1
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ struct intel_iommu {
	int		msagaw; /* max sagaw of this iommu */
	unsigned int	irq, pr_irq, perf_irq;
	u16		segment;     /* PCI segment# */
	unsigned char 	name[13];    /* Device Name */
	unsigned char	name[16];    /* Device Name */

#ifdef CONFIG_INTEL_IOMMU
	unsigned long 	*domain_ids; /* bitmap of domains */