Whamcloud - gitweb
b=13858
authorkalpak <kalpak>
Tue, 13 Nov 2007 14:51:36 +0000 (14:51 +0000)
committerkalpak <kalpak>
Tue, 13 Nov 2007 14:51:36 +0000 (14:51 +0000)
i=fanyong

key may not be NULL terminated on HEAD, so change KEY_IS() macro to use strncmp() instead of strcmp.

lustre/include/obd_support.h

index a883129..469ded9 100644 (file)
@@ -715,7 +715,7 @@ do {                                                                          \
 #define OBD_SLAB_FREE_PTR(ptr, slab)                                          \
         OBD_SLAB_FREE((ptr), (slab), sizeof *(ptr))
 
-#define KEY_IS(str) (keylen >= strlen(str) && strcmp(key, str) == 0)
+#define KEY_IS(str) (keylen >= strlen(str) && strncmp(key, str, keylen) == 0)
 
 /* Wrapper for contiguous page frame allocation */
 #define OBD_PAGES_ALLOC(ptr, order, gfp_mask)                                 \