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
  • bitmap.c
Find file BlameHistoryPermalink
  • Rasmus Villemoes's avatar
    lib/bitmap.c: simplify bitmap_print_to_pagebuf() · 8ec3d768
    Rasmus Villemoes authored Oct 30, 2018
    len is guaranteed to lie in [1, PAGE_SIZE].  If scnprintf is called with a
    buffer size of 1, it is guaranteed to return 0.  So in the extremely
    unlikely case of having just one byte remaining in the page, let's just
    call scnprintf anyway.  The only difference is that this will write a '\0'
    to that final byte in the page, but that's an improvement: We now
    guarantee that after the call, buf is a properly terminated C string of
    length exactly the return value.
    
    Link: http://lkml.kernel.org/r/20180818131623.8755-8-linux@rasmusvillemoes.dk
    
    
    Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
    Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Cc: Yury Norov <ynorov@caviumnetworks.com>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8ec3d768
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7