LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc()

Fix a possible NULL pointer deref in case alloc_pages() fails.
This is theoretical so far as up to now no code in the tree uses
linuxkpi_page_frag_alloc().

Reported by:	Coverity via emaste
Coverity ID:	1502345
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC-with:	55038a6306
This commit is contained in:
Bjoern A. Zeeb 2023-01-11 23:40:05 +00:00
parent ad70f2e22e
commit 51e94a4658

View File

@ -451,6 +451,8 @@ linuxkpi_page_frag_alloc(struct page_frag_cache *pfc,
"supported", __func__, fragsz));
pages = alloc_pages(gfp, flsl(howmany(fragsz, PAGE_SIZE) - 1));
if (pages == NULL)
return (NULL);
pfc->va = linux_page_address(pages);
/* Passed in as "count" to __page_frag_cache_drain(). Unused by us. */