libceph: fix off-by-one bug in ceph_encode_filepath()
[firefly-linux-kernel-4.4.55.git] / include / linux / ceph / decode.h
index d8615dee5808d3f55c93a38c6fdb66113f09a691..bcbd66c84890086c3d9219286fb9a689d64b70b0 100644 (file)
@@ -151,7 +151,7 @@ static inline void ceph_encode_filepath(void **p, void *end,
                                        u64 ino, const char *path)
 {
        u32 len = path ? strlen(path) : 0;
-       BUG_ON(*p + sizeof(ino) + sizeof(len) + len > end);
+       BUG_ON(*p + 1 + sizeof(ino) + sizeof(len) + len > end);
        ceph_encode_8(p, 1);
        ceph_encode_64(p, ino);
        ceph_encode_32(p, len);