Merge branches 'fixes' and 'fixes2' into devel-late
[firefly-linux-kernel-4.4.55.git] / drivers / base / node.c
index 90aa2a11a933b448a536a353c5d932668c3f8e11..af1a177216f12573c7e481fea0a568c09b97ef12 100644 (file)
@@ -592,11 +592,9 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
 {
        int n;
 
-       n = nodelist_scnprintf(buf, PAGE_SIZE, node_states[state]);
-       if (n > 0 && PAGE_SIZE > n + 1) {
-               *(buf + n++) = '\n';
-               *(buf + n++) = '\0';
-       }
+       n = nodelist_scnprintf(buf, PAGE_SIZE-2, node_states[state]);
+       buf[n++] = '\n';
+       buf[n] = '\0';
        return n;
 }