Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR().

The normal expectation for ERR_PTR() is to put a negative errno into a
pointer. oom_kill puts the magic -1 in the result (and has since
pre-git), which is probably clearer with an explicit cast.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

+3 -3
+3 -3
mm/oom_kill.c
··· 288 288 289 289 /* 290 290 * Simple selection loop. We chose the process with the highest 291 - * number of 'points'. 291 + * number of 'points'. Returns -1 on scan abort. 292 292 * 293 293 * (not docbooked, we don't want this one cluttering up the manual) 294 294 */ ··· 314 314 continue; 315 315 case OOM_SCAN_ABORT: 316 316 rcu_read_unlock(); 317 - return ERR_PTR(-1UL); 317 + return (struct task_struct *)(-1UL); 318 318 case OOM_SCAN_OK: 319 319 break; 320 320 }; ··· 657 657 dump_header(NULL, gfp_mask, order, NULL, mpol_mask); 658 658 panic("Out of memory and no killable processes...\n"); 659 659 } 660 - if (PTR_ERR(p) != -1UL) { 660 + if (p != (void *)-1UL) { 661 661 oom_kill_process(p, gfp_mask, order, points, totalpages, NULL, 662 662 nodemask, "Out of memory"); 663 663 killed = 1;