[PATCH 3/5] riscv: mm: Fix NULL pointer dereference in __set_memory

Mike Rapoport rppt at kernel.org
Fri Apr 10 00:53:57 PDT 2026


On Fri, Apr 10, 2026 at 09:42:26AM +0200, David Hildenbrand (Arm) wrote:
> On 4/10/26 08:23, Michael Neuling wrote:
> >>>               area = find_vm_area((void *)start);
> >>> +             if (!area) {
> >>> +                     ret = -EINVAL;
> >>> +                     goto unlock;
> >>> +             }
> >>>               page_start = (start - (unsigned long)area->addr) >> PAGE_SHIFT;
> >>>
> >>>               for (i = page_start; i < page_start + numpages; ++i) {
> >>
> >> Which caller would end up calling __set_memory() in such a way?
> > 
> > It wouldn't. You're right on this and the other two. Sorry for the noise.
> 
> Slopped-by: Cursor:claude-4.6-opus-high-thinking
> 
> :)

It's a general tendency of LLMs to generate overly defensive code and raise
concerns about theoretical issues.
Maybe it's worth taking into account when writing prompts specific to
kernel development.
 
> Patch #1 seems reasonable (although non-critical); not sure about patch
> #2, leaving both to Risc-V people!
> 
> -- 
> Cheers,
> 
> David

-- 
Sincerely yours,
Mike.



More information about the linux-riscv mailing list