Source
137
137
struct pcpu_chunk *chunk;
138
138
int slot, max_nr_alloc;
139
139
int *buffer;
140
140
141
141
alloc_buffer:
142
142
spin_lock_irq(&pcpu_lock);
143
143
max_nr_alloc = find_max_nr_alloc();
144
144
spin_unlock_irq(&pcpu_lock);
145
145
146
146
/* there can be at most this many free and allocated fragments */
147
-
buffer = vmalloc((2 * max_nr_alloc + 1) * sizeof(int));
147
+
buffer = vmalloc(array_size(sizeof(int), (2 * max_nr_alloc + 1)));
148
148
if (!buffer)
149
149
return -ENOMEM;
150
150
151
151
spin_lock_irq(&pcpu_lock);
152
152
153
153
/* if the buffer allocated earlier is too small */
154
154
if (max_nr_alloc < find_max_nr_alloc()) {
155
155
spin_unlock_irq(&pcpu_lock);
156
156
vfree(buffer);
157
157
goto alloc_buffer;