On Mon, 24 Mar 2025 21:14:48 -0700 Penglei Jiang <superman.xpt@xxxxxxxxx> wrote: > > > if (IS_ERR(mm)) > > > -return mm == ERR_PTR(-ESRCH) ? NULL : mm; > > > +return mm; > > > > > > /* ensure this mm_struct can't be freed */ > > > mmgrab(mm); > > > -- > > > 2.17.1 > > > > > Mateusz Guzik provides valuable suggestions. > > Complete the missing NULL checks. proc_mem_open() can return errno, NULL or mm_struct*. It isn't obvious why. While you're in there can you please add documentation to proc_mem_open() which explains its return values?