struct fsverity_info contains information that is only read in the
verification path.  Apply the const qualifier to match various explicitly
passed arguments.

Signed-off-by: Christoph Hellwig <[email protected]>
---
 fs/verity/verify.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index 32cadb71953c..881af159e705 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -21,7 +21,7 @@ struct fsverity_pending_block {
 
 struct fsverity_verification_context {
        struct inode *inode;
-       struct fsverity_info *vi;
+       const struct fsverity_info *vi;
 
        /*
         * This is the queue of data blocks that are pending verification.  When
@@ -84,8 +84,8 @@ EXPORT_SYMBOL_GPL(fsverity_readahead);
  * Returns true if the hash block with index @hblock_idx in the tree, located 
in
  * @hpage, has already been verified.
  */
-static bool is_hash_block_verified(struct fsverity_info *vi, struct page 
*hpage,
-                                  unsigned long hblock_idx)
+static bool is_hash_block_verified(const struct fsverity_info *vi,
+                                  struct page *hpage, unsigned long hblock_idx)
 {
        unsigned int blocks_per_page;
        unsigned int i;
@@ -156,7 +156,8 @@ static bool is_hash_block_verified(struct fsverity_info 
*vi, struct page *hpage,
  *
  * Return: %true if the data block is valid, else %false.
  */
-static bool verify_data_block(struct inode *inode, struct fsverity_info *vi,
+static bool verify_data_block(struct inode *inode,
+                             const struct fsverity_info *vi,
                              const struct fsverity_pending_block *dblock)
 {
        const u64 data_pos = dblock->pos;
@@ -315,7 +316,7 @@ static void
 fsverity_init_verification_context(struct fsverity_verification_context *ctx,
                                   struct inode *inode)
 {
-       struct fsverity_info *vi = *fsverity_info_addr(inode);
+       const struct fsverity_info *vi = *fsverity_info_addr(inode);
 
        ctx->inode = inode;
        ctx->vi = vi;
@@ -342,7 +343,7 @@ fsverity_clear_pending_blocks(struct 
fsverity_verification_context *ctx)
 static bool
 fsverity_verify_pending_blocks(struct fsverity_verification_context *ctx)
 {
-       struct fsverity_info *vi = ctx->vi;
+       const struct fsverity_info *vi = ctx->vi;
        const struct merkle_tree_params *params = &vi->tree_params;
        int i;
 
@@ -372,7 +373,7 @@ static bool fsverity_add_data_blocks(struct 
fsverity_verification_context *ctx,
                                     struct folio *data_folio, size_t len,
                                     size_t offset)
 {
-       struct fsverity_info *vi = ctx->vi;
+       const struct fsverity_info *vi = ctx->vi;
        const struct merkle_tree_params *params = &vi->tree_params;
        const unsigned int block_size = params->block_size;
        u64 pos = (u64)data_folio->index << PAGE_SHIFT;
-- 
2.47.3



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to