Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • include
  • linux
  • blkdev.h
Find file BlameHistoryPermalink
  • Li Nan's avatar
    md: Fix overflow in is_mddev_idle · 3f9f2312
    Li Nan authored Jan 17, 2024
    
    
    UBSAN reports this problem:
    
      UBSAN: Undefined behaviour in drivers/md/md.c:8175:15
      signed integer overflow:
      -2147483291 - 2072033152 cannot be represented in type 'int'
      Call trace:
       dump_backtrace+0x0/0x310
       show_stack+0x28/0x38
       dump_stack+0xec/0x15c
       ubsan_epilogue+0x18/0x84
       handle_overflow+0x14c/0x19c
       __ubsan_handle_sub_overflow+0x34/0x44
       is_mddev_idle+0x338/0x3d8
       md_do_sync+0x1bb8/0x1cf8
       md_thread+0x220/0x288
       kthread+0x1d8/0x1e0
       ret_from_fork+0x10/0x18
    
    'curr_events' will overflow when stat accum or 'sync_io' is greater than
    INT_MAX.
    
    Fix it by changing sync_io, last_events and curr_events to 64bit.
    
    Signed-off-by: default avatarLi Nan <linan122@huawei.com>
    Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
    Link: https://lore.kernel.org/r/20240117031946.2324519-2-linan666@huaweicloud.com
    
    
    Signed-off-by: default avatarSong Liu <song@kernel.org>
    3f9f2312
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7