Subject: Coverity: shrink_node_memcgs(): Null pointer dereferences

From: coverity-bot <[email-masked]>
Date: Mon, 11 Nov 2019 17:35:37 -0800

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191108 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by recent commits:

c34aa3085f94 ("mm-vmscan-split-shrink_node-into-node-part-and-memcgs-part-fix")

Coverity reported the following:

*** CID 1487844:  Null pointer dereferences  (NULL_RETURNS)
/mm/vmscan.c: 2695 in shrink_node_memcgs()
2689     	memcg = mem_cgroup_iter(target_memcg, NULL, NULL);
2690     	do {
2691     		struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
2692     		unsigned long reclaimed;
2693     		unsigned long scanned;
2694
vvv     CID 1487844:  Null pointer dereferences  (NULL_RETURNS)
vvv     Dereferencing a pointer that might be "NULL" "memcg" when calling "mem_cgroup_protected".
2695     		switch (mem_cgroup_protected(target_memcg, memcg)) {
2696     		case MEMCG_PROT_MIN:
2697     			/*
2698     			 * Hard protection.
2699     			 * If there is no reclaimable memory, OOM.
2700     			 */

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1487844 ("Null pointer dereferences")
Fixes: c34aa3085f94 ("mm-vmscan-split-shrink_node-into-node-part-and-memcgs-part-fix")

Thanks for your attention!

-- 
Coverity-bot