Dan Carpenter wrote:
> Hello Tetsuo Handa,

Hello, Dan.

> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 77ed2c5745d9: "android,lowmemorykiller: Don't abuse 
> TIF_MEMDIE." from Mar 8, 2016, leads to the following Smatch 
> complaint:
> 
> drivers/staging/android/lowmemorykiller.c:145 lowmem_scan()
>        error: we previously assumed 'p->mm' could be null (see line 134)

This is a false positive. find_lock_task_mm() returns a task_struct
whose mm is not NULL (with alloc_lock spinlock held).

> 
> drivers/staging/android/lowmemorykiller.c
>    133        
>    134                        if (task_lmk_waiting(p) && p->mm &&
>                                                    ^^^^^
> Patch adds a new check.
> 
>    135                            time_before_eq(jiffies, 
> lowmem_deathpending_timeout)) {
>    136                                task_unlock(p);
>    137                                rcu_read_unlock();
>    138                                return 0;
>    139                        }
>    140                        oom_score_adj = p->signal->oom_score_adj;
>    141                        if (oom_score_adj < min_score_adj) {
>    142                                task_unlock(p);
>    143                                continue;
>    144                        }
>    145                        tasksize = get_mm_rss(p->mm);
>                                               ^^^^^
> Old unchecked dereference inside function call.

At this point alloc_lock spinlock is still held.
Thus, this mm is not NULL.

> 
>    146                        task_unlock(p);
>    147                        if (tasksize <= 0)
> 
> regards,
> dan carpenter
> 

Thanks.
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to