• Sudeep Holla's avatar
    bitmap: remove explicit newline handling using scnprintf format string · 9cf79d11
    Sudeep Holla authored
    bitmap_print_to_pagebuf uses scnprintf to copy the cpumask/list to page
    buffer.  It handles the newline and trailing null character explicitly.
    
    It's unnecessary and also partially duplicated as scnprintf already adds
    trailing null character.  The newline can be passed through format
    string to scnprintf.  This patch does that simplification.
    
    However theoretically there's one behavior difference: when the buffer
    is too small, the original code would still output '\n' at the end while
    the new code(with this patch) would just continue to print the formatted
    string.  Since this function is dealing with only page buffers, it's
    highly unlikely to hit that corner case.
    
    This patch will help in auditing the users of bitmap_print_to_pagebuf to
    verify that the buffer passed is large enough and get rid of it
    completely by replacing them with direct scnprintf()
    
    [akpm@linux-foundation.org: tweak comment]
    Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    Suggested-by: default avatarPawel Moll <Pawel.Moll@arm.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9cf79d11
bitmap.c 32.6 KB