Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0b030c2c2f0f1d98d5fe412e5b7cf7fd53f5221a
Commit:     0b030c2c2f0f1d98d5fe412e5b7cf7fd53f5221a
Parent:     5a75983eef1193c43caebde6643a218bd8d8390e
Author:     Andi Kleen <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 5 14:50:56 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Nov 5 15:12:32 2007 -0800

    Fix bitmap_scnlistprintf for empty masks
    
    When a bitmap is empty bitmap_scnlistprintf() would leave the buffer
    uninitialized.  Set it to an empty string in this case.
    
    I didn't see any in normal kernel callers hitting this, but some custom
    debug code of mine did.
    
    Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
    Acked-by: Paul Jackson <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 lib/bitmap.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/bitmap.c b/lib/bitmap.c
index 26ebafa..2c9242e 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsigned int buflen,
        /* current bit is 'cur', most recently seen range is [rbot, rtop] */
        int cur, rbot, rtop;
 
+       if (buflen == 0)
+               return 0;
+       buf[0] = 0;
+
        rbot = cur = find_first_bit(maskp, nmaskbits);
        while (cur < nmaskbits) {
                rtop = cur;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to