]> git.baikalelectronics.ru Git - kernel.git/commit
proc: skip branch in /proc/*/* lookup
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 14 Jun 2018 22:27:17 +0000 (15:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 14 Jun 2018 22:55:24 +0000 (07:55 +0900)
commita1b95f209fb06d31e99b4b7bc2b1af79de4f3102
tree1f31d199ff9290dbd082a2559731fb6fce193edc
parent6d0173d891d7eab53b819a387fb17c052a4bb680
proc: skip branch in /proc/*/* lookup

Code is structured like this:

for ( ... p < last; p++) {
if (memcmp == 0)
break;
}
if (p >= last)
ERROR
OK

gcc doesn't see that if if lookup succeeds than post loop branch will
never be taken and skip it.

[akpm@linux-foundation.org: proc_pident_instantiate() no longer takes an inode*]
Link: http://lkml.kernel.org/r/20180423213954.GD9043@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c