hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/wireguard/ratelimiter.c
....@@ -170,18 +170,18 @@
170170 * we borrow their wisdom about good table sizes on different systems
171171 * dependent on RAM. This calculation here comes from there.
172172 */
173
- table_size = (totalram_pages > (1U << 30) / PAGE_SIZE) ? 8192 :
173
+ table_size = (totalram_pages() > (1U << 30) / PAGE_SIZE) ? 8192 :
174174 max_t(unsigned long, 16, roundup_pow_of_two(
175
- (totalram_pages << PAGE_SHIFT) /
175
+ (totalram_pages() << PAGE_SHIFT) /
176176 (1U << 14) / sizeof(struct hlist_head)));
177177 max_entries = table_size * 8;
178178
179
- table_v4 = kvzalloc(table_size * sizeof(*table_v4), GFP_KERNEL);
179
+ table_v4 = kvcalloc(table_size, sizeof(*table_v4), GFP_KERNEL);
180180 if (unlikely(!table_v4))
181181 goto err_kmemcache;
182182
183183 #if IS_ENABLED(CONFIG_IPV6)
184
- table_v6 = kvzalloc(table_size * sizeof(*table_v6), GFP_KERNEL);
184
+ table_v6 = kvcalloc(table_size, sizeof(*table_v6), GFP_KERNEL);
185185 if (unlikely(!table_v6)) {
186186 kvfree(table_v4);
187187 goto err_kmemcache;