On Wed, Jul 31, 2024 at 6:48 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > On 7/31/24 12:44 PM, Tetsuo Handa wrote: > > On 2024/07/31 19:29, Vlastimil Babka wrote: > >>> @@ -827,8 +827,10 @@ kvmalloc_array_node_noprof(size_t n, size_t size, gfp_t flags, int node) > >>> { > >>> size_t bytes; > >>> > >>> - if (unlikely(check_mul_overflow(n, size, &bytes))) > >>> + if (unlikely(check_mul_overflow(n, size, &bytes))) { > >>> + BUG_ON(flags & __GFP_NOFAIL); > >> > >> Shouldn't we produce some kind of warning also in the no-NOFAIL case? > >> Returning a NULL completely silently feels wrong. > > > > Doesn't embedding macros like BUG_ON() into inline functions needlessly bloat > > the kernel size? I think we can call a non-inlined function (that is marked > > as EXPORT_SYMBOL()) for emitting warning. > > Hm yeah we could probably make the whole function non-inline as it results > in a call anyway. Although this might save some code footprint, we will result in two calls for users of kvmalloc_array_node_noprof() with both Tetsuo's and your proposal?