File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,28 @@ static inline void __compat_kvfree(const void *addr)
515
515
#define kvfree __compat_kvfree
516
516
#endif
517
517
518
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 12 , 0 )
519
+ #include <linux/vmalloc.h>
520
+ #include <linux/mm.h>
521
+ static inline void * __compat_kvmalloc_array (size_t n , size_t size , gfp_t flags )
522
+ {
523
+ if (n != 0 && SIZE_MAX / n < size )
524
+ return NULL ;
525
+ return kvmalloc (n * size , flags );
526
+ }
527
+ #define kvmalloc_array __compat_kvmalloc_array
528
+ #endif
529
+
530
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 18 , 0 )
531
+ #include <linux/vmalloc.h>
532
+ #include <linux/mm.h>
533
+ static inline void * __compat_kvcalloc (size_t n , size_t size , gfp_t flags )
534
+ {
535
+ return kvmalloc_array (n , size , flags | __GFP_ZERO );
536
+ }
537
+ #define kvcalloc __compat_kvcalloc
538
+ #endif
539
+
518
540
#if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 11 , 9 )
519
541
#include <linux/netdevice.h>
520
542
#define priv_destructor destructor
Original file line number Diff line number Diff line change @@ -188,12 +188,12 @@ int wg_ratelimiter_init(void)
188
188
(1U << 14 ) / sizeof (struct hlist_head )));
189
189
max_entries = table_size * 8 ;
190
190
191
- table_v4 = kvzalloc (table_size * sizeof (* table_v4 ), GFP_KERNEL );
191
+ table_v4 = kvcalloc (table_size , sizeof (* table_v4 ), GFP_KERNEL );
192
192
if (unlikely (!table_v4 ))
193
193
goto err_kmemcache ;
194
194
195
195
#if IS_ENABLED (CONFIG_IPV6 )
196
- table_v6 = kvzalloc (table_size * sizeof (* table_v6 ), GFP_KERNEL );
196
+ table_v6 = kvcalloc (table_size , sizeof (* table_v6 ), GFP_KERNEL );
197
197
if (unlikely (!table_v6 )) {
198
198
kvfree (table_v4 );
199
199
goto err_kmemcache ;
You can’t perform that action at this time.
0 commit comments