Skip to contentSkip to conversation

iomap: track pending read bytes more optimally

bug report Dan Carpenter 1 participant 1 message Oct 31, 2025 VFS

lore
Share & tools
lore
#0 lore raw

Hello Joanne Koong,

Commit 51311f045375 ("iomap: track pending read bytes more optimally") from Sep 25, 2025 (linux-next), leads to the following Smatch static checker warning:

fs/iomap/buffered-io.c:547 iomap_readahead()
error: uninitialized symbol 'cur_bytes_pending'.

fs/iomap/buffered-io.c
526 void iomap_readahead(const struct iomap_ops *ops,
527 struct iomap_read_folio_ctx *ctx)
528 {
529 struct readahead_control *rac = ctx->rac;
530 struct iomap_iter iter = {

   531                  .inode  = rac->mapping->host,
   532                  .pos    = readahead_pos(rac),
   533                  .len    = readahead_length(rac),

534 };
535 size_t cur_bytes_pending;
536
537 trace_iomap_readahead(rac->mapping->host, readahead_count(rac));
538
539 while (iomap_iter(&iter, ops) > 0)
540 iter.status = iomap_readahead_iter(&iter, ctx,
541 &cur_bytes_pending);

Smatch worries that either iomap_iter() or iomap_length() might be false on the first iteration. I don't know the code so it could be a false positive.

   542  
   543          if (ctx->ops->submit_read)
   544                  ctx->ops->submit_read(ctx);
   545  
   546          if (ctx->cur_folio)
   547                  iomap_read_end(ctx->cur_folio, cur_bytes_pending);
   548  }

regards,
dan carpenter