lkml.org 
[lkml]   [2022]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/filemap: Fix NULL pointer dereference in pagecache_get_page
On Tue, Apr 26, 2022 at 04:25:48PM +0800, Wan Jiabing wrote:
> Fix following coccicheck error:
> mm/folio-compat.c:128:17-21: ERROR: folio is NULL but dereferenced.
> folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
> - if ((fgp_flags & FGP_HEAD) || !folio || xa_is_value(folio))
> + if (!folio)
> + return NULL;
> + if ((fgp_flags & FGP_HEAD) || xa_is_value(folio))
> return &folio->page;

That doesn't dereference the folio. Coccicheck is wrong.

\
 
 \ /
  Last update: 2022-04-26 14:09    [W:0.045 / U:2.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site