From: Tommi Virtanen Date: Wed, 2 Feb 2011 19:39:32 +0000 (-0800) Subject: libceph: Fix base64-decoding when input ends in newline. X-Git-Tag: v2.6.39-rc4~26^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b09734b1f4abd86e046777f0f268215b4ef1b523;p=platform%2Fkernel%2Flinux-stable.git libceph: Fix base64-decoding when input ends in newline. It used to return -EINVAL because it thought the end was not aligned to 4 bytes. Clean up superfluous src < end test in if, the while itself guarantees that. Signed-off-by: Tommi Virtanen Signed-off-by: Sage Weil --- diff --git a/net/ceph/armor.c b/net/ceph/armor.c index eb2a666..1fc1ee1 100644 --- a/net/ceph/armor.c +++ b/net/ceph/armor.c @@ -78,8 +78,10 @@ int ceph_unarmor(char *dst, const char *src, const char *end) while (src < end) { int a, b, c, d; - if (src < end && src[0] == '\n') + if (src[0] == '\n') { src++; + continue; + } if (src + 4 > end) return -EINVAL; a = decode_bits(src[0]);