summaryrefslogtreecommitdiffstats
path: root/fs/verity/enable.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-03-27 21:03:26 -0700
committerEric Biggers <ebiggers@google.com>2023-04-11 19:23:15 -0700
commit8eb8af4b3df5965dc65a24a32768043f39d82d59 (patch)
treef680ac37d09ca342cb5598bd8149c8335933f18c /fs/verity/enable.c
parent1238c8b91c5aca6dd13bccb1b4dc716718e7bfac (diff)
downloadlinux-8eb8af4b3df5965dc65a24a32768043f39d82d59.tar.gz
linux-8eb8af4b3df5965dc65a24a32768043f39d82d59.tar.bz2
linux-8eb8af4b3df5965dc65a24a32768043f39d82d59.zip
fsverity: use WARN_ON_ONCE instead of WARN_ON
As per Linus's suggestion (https://lore.kernel.org/r/CAHk-=whefxRGyNGzCzG6BVeM=5vnvgb-XhSeFJVxJyAxAF8XRA@mail.gmail.com), use WARN_ON_ONCE instead of WARN_ON. This barely adds any extra overhead, and it makes it so that if any of these ever becomes reachable (they shouldn't, but that's the point), the logs can't be flooded. Link: https://lore.kernel.org/r/20230406181542.38894-1-ebiggers@kernel.org Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/verity/enable.c')
-rw-r--r--fs/verity/enable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/verity/enable.c b/fs/verity/enable.c
index 7a0e3a84d370..541c2a277c5c 100644
--- a/fs/verity/enable.c
+++ b/fs/verity/enable.c
@@ -165,7 +165,7 @@ static int build_merkle_tree(struct file *filp,
}
}
/* The root hash was filled by the last call to hash_one_block(). */
- if (WARN_ON(buffers[num_levels].filled != params->digest_size)) {
+ if (WARN_ON_ONCE(buffers[num_levels].filled != params->digest_size)) {
err = -EINVAL;
goto out;
}
@@ -277,7 +277,7 @@ static int enable_verity(struct file *filp,
fsverity_err(inode, "%ps() failed with err %d",
vops->end_enable_verity, err);
fsverity_free_info(vi);
- } else if (WARN_ON(!IS_VERITY(inode))) {
+ } else if (WARN_ON_ONCE(!IS_VERITY(inode))) {
err = -EINVAL;
fsverity_free_info(vi);
} else {