Whamcloud - gitweb
Merge b1_8_gate from b1_6 (20080708_1553)
authoradilger <adilger>
Wed, 9 Jul 2008 00:03:29 +0000 (00:03 +0000)
committeradilger <adilger>
Wed, 9 Jul 2008 00:03:29 +0000 (00:03 +0000)
Mostly minor cleanups.
Make ChangeLog consistent.
Bump build version to v1_7_51.

lustre/ldlm/ldlm_resource.c

index d7b80a8..3649a93 100644 (file)
@@ -136,12 +136,14 @@ static int lprocfs_wr_lru_size(struct file *file, const char *buffer,
                                unsigned long count, void *data)
 {
         struct ldlm_namespace *ns = data;
-        char dummy[MAX_STRING_SIZE + 1], *end;
+        char dummy[MAX_STRING_SIZE + 1] = { '\0' }, *end;
         unsigned long tmp;
         int lru_resize;
 
-        dummy[MAX_STRING_SIZE] = '\0';
-        if (copy_from_user(dummy, buffer, MAX_STRING_SIZE))
+        if (count >= sizeof(dummy) || count == 0)
+                return -EINVAL;
+
+        if (copy_from_user(dummy, buffer, count))
                 return -EFAULT;
 
         if (strncmp(dummy, "clear", 5) == 0) {
@@ -365,7 +367,6 @@ ldlm_namespace_new(struct obd_device *obd, char *name,
         }
 
         at_init(&ns->ns_at_estimate, ldlm_enqueue_min, 0);
-
         ldlm_namespace_register(ns, client);
         RETURN(ns);
 out_proc: