Skip to contentSkip to conversation

xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX

PATCH In review Gao Xiang 3 participants 3 messages Mar 9, 2021 – Mar 11, 2021 1 message not in the archive XFS filesystem

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Gao Xiang

author
#1 lore raw

PATCH 1/1 xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX

From: Gao Xiang <[email protected]>

Add the BUILD_BUG_ON to xfs_errortag_add() in order to make sure that the length of xfs_errortag_random_default matches XFS_ERRTAG_MAX when building.

---
 fs/xfs/xfs_error.c | 1 +
 1 file changed, 1 insertion(+)
fs/xfs/xfs_error.c +1 -0
index 185b4915b7bf..82425c9a623d 100644
@@ -299,6 +299,7 @@ xfs_errortag_add(
 	struct xfs_mount	*mp,
 	unsigned int		error_tag)
 {
+	BUILD_BUG_ON(ARRAY_SIZE(xfs_errortag_random_default) != XFS_ERRTAG_MAX);
 	if (error_tag >= XFS_ERRTAG_MAX)
 		return -EINVAL;
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 7 lines · Gao Xiang

From: Gao Xiang <[email protected]>

Add the BUILD_BUG_ON to xfs_errortag_add() in order to make sure that the length of xfs_errortag_random_default matches XFS_ERRTAG_MAX when building.

Yay!

--D

Quoted 19 lines
---
 fs/xfs/xfs_error.c | 1 +
 1 file changed, 1 insertion(+)
fs/xfs/xfs_error.c +1 -0
index 185b4915b7bf..82425c9a623d 100644
@@ -299,6 +299,7 @@ xfs_errortag_add(
 	struct xfs_mount	*mp,
 	unsigned int		error_tag)
 {
+	BUILD_BUG_ON(ARRAY_SIZE(xfs_errortag_random_default) != XFS_ERRTAG_MAX);
 	if (error_tag >= XFS_ERRTAG_MAX)
 		return -EINVAL;
 
Signature · 1 line
2.20.1