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
  • lib
  • mpi
  • mpicoder.c
Find file BlameHistoryPermalink
  • Nicolai Stange's avatar
    lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs · 66c95e69
    Nicolai Stange authored Mar 22, 2016
    BugLink: http://bugs.launchpad.net/bugs/1624037
    
    commit f2d1362f upstream.
    
    Currently, if the number of leading zeros is greater than fits into a
    complete limb, mpi_write_sgl() skips them by iterating over them limb-wise.
    
    However, it fails to adjust its internal leading zeros tracking variable,
    lzeros, accordingly: it does a
    
      p -= sizeof(alimb);
      continue;
    
    which should really have been a
    
      lzeros -= sizeof(alimb);
      continue;
    
    Since lzeros never decreases if its initial value >= sizeof(alimb), nothing
    gets copied by mpi_write_sgl() in that case.
    
    Instead of skipping the high order zero limbs within the loop as shown
    above, fix the issue by adjusting the copying loop's bounds.
    
    Fixes: 2d4d1eea
    
     ("lib/mpi: Add mpi sgl helpers")
    Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
    Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
    66c95e69
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7