aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index ad43185ec15..985abd7f49a 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -15,6 +15,7 @@
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <linux/gfp.h>
18 19
19static struct sysdev_class_attribute *node_state_attrs[]; 20static struct sysdev_class_attribute *node_state_attrs[];
20 21
@@ -165,8 +166,11 @@ static ssize_t node_read_distance(struct sys_device * dev,
165 int len = 0; 166 int len = 0;
166 int i; 167 int i;
167 168
168 /* buf currently PAGE_SIZE, need ~4 chars per node */ 169 /*
169 BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2); 170 * buf is currently PAGE_SIZE in length and each node needs 4 chars
171 * at the most (distance + space or newline).
172 */
173 BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE);
170 174
171 for_each_online_node(i) 175 for_each_online_node(i)
172 len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); 176 len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));