On Thu, May 13, 2021 at 02:29:13PM +0200, Marco Elver wrote: > On Thu, 13 May 2021 at 14:03, Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> wrote: > > On Thu, May 13, 2021 at 12:31:38PM +0200, Marco Elver wrote: > [...] > > what about checking size it on top of kmalloc_index? because by definition of > > KMALLOC_SHIFT_HIGH, it's not always 25. it can be less than 25. for some > > situations. > > > > below is what I suggested beofre. for just reference: > > This doesn't solve the problem. We want the compiler to complain > whenever kmalloc_index() is used with non-constant in normal code. in the beginning, I thought kmalloc_index is called only from kmalloc. but if kmalloc_index is called from other place, I think it should correctly check its size. that's what kmalloc_index should do. or... should it be solved as another patch?