[PATCH net] net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()

2020-08-31 Thread Shung-Hsi Yu
On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a max_order of 31 will be passed to mlx_buddy_init(), which results in s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to kvmalloc_array() failure when it is converted to size_t. mlx4_core :b1:00.0: Failed to i

Re: [PATCH net] net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()

2020-09-01 Thread David Miller
From: Shung-Hsi Yu Date: Mon, 31 Aug 2020 22:37:09 +0800 > On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a > max_order of 31 will be passed to mlx_buddy_init(), which results in > s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to > kvmalloc_array() failure whe