- bitmap-fix-calculation-of-bitmap_scnprintf_len.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     bitmap: Fix calculation of bitmap_scnprintf_len()
has been removed from the -mm tree.  Its filename was
     bitmap-fix-calculation-of-bitmap_scnprintf_len.patch

This patch was dropped because of confusion

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: bitmap: Fix calculation of bitmap_scnprintf_len()
From: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>

The function bitmap_scnprintf_len() is currently not used, but the returned
value is 4 times larger than needed.  This value is also only a good upper
bound.  Which should be mentioned in the comment.

The correct number of chars needed for the buffer, exluding any new line and
terminating zero is:

int bitmap_scnprintf_len(int len)
{
	return  /* complete hunks with commas */
	          ((len / CHUNKSZ) * 9)
	        /* partial hunk, 4 bits in one char */
	       + (((len % CHUNKSZ) + 3) / 4)
	        /* one less comma, if no partial hunk */
	       -  !(len % CHUNKSZ);
}

Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>
Cc: Mike Travis <travis@xxxxxxx>
Cc: Paul Jackson <pj@xxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/bitmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN lib/bitmap.c~bitmap-fix-calculation-of-bitmap_scnprintf_len lib/bitmap.c
--- a/lib/bitmap.c~bitmap-fix-calculation-of-bitmap_scnprintf_len
+++ a/lib/bitmap.c
@@ -325,7 +325,7 @@ int bitmap_scnprintf_len(unsigned int le
 	/* we need 9 chars per word for 32 bit words (8 hexdigits + sep/null) */
 	int bitslen = ALIGN(len, CHUNKSZ);
 	int wordlen = CHUNKSZ / 4;
-	int buflen = (bitslen / wordlen) * (wordlen + 1) * sizeof(char);
+	int buflen = (bitslen / CHUNKSZ) * (wordlen + 1);
 
 	return buflen;
 }
_

Patches currently in -mm which might be from bert.wesarg@xxxxxxxxxxxxxx are

bitmap-fix-calculation-of-bitmap_scnprintf_len.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux