On Fri, Apr 14, 2023 at 02:01:29PM +0200, Alexander Bluhm wrote: > > On Thu, Apr 13, 2023 at 10:43:30AM +0800, Kevin Lo wrote: > > M_CANFAIL > > In the M_WAITOK case, if not enough memory is available, > > return NULL instead of calling panic(9). If mallocarray() > > Did you see such a panic? If yes it would be better to understand > and fix the root cause.
No, I didn't see that. > > detects an overflow or malloc() detects an excessive > > allocation, return NULL instead of calling panic(9). > > > > > > I'd like to keep the mallocarray call unchanged so I add M_CANFAIL > > to the flags. > > I think you are trying to change the kernel in the wrong direction. > It should not fail, but handle the requests. Panic if there is a > bug. > > Why do you think M_CANFAIL is a good thing at this place? Because M_WAITOK will not return NULl, I think adding M_CANFAIL will keep the mallocarray call unchanged. > bluhm >