projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3ee2a19
)
proc: use do-while in name_to_int()
author
Alexey Dobriyan
<
[email protected]
>
Fri, 17 Nov 2017 23:26:52 +0000
(15:26 -0800)
committer
Linus Torvalds
<
[email protected]
>
Sat, 18 Nov 2017 00:10:00 +0000
(16:10 -0800)
Gcc doesn't know that "len" is guaranteed to be >=1 by dcache and
generates standard while-loop prologue duplicating loop condition.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-27 (-27)
function old new delta
name_to_int 104 77 -27
Link:
http://lkml.kernel.org/r/20170912195213.GB17730@avx2
Signed-off-by: Alexey Dobriyan <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
fs/proc/util.c
patch
|
blob
|
history
diff --git
a/fs/proc/util.c
b/fs/proc/util.c
index c29aa497394b870170f3cff8da823b3c7e99eaa9..b161cfa0f9fa15dce4e2afdc7d71bd0b3925ba3c 100644
(file)
--- a/
fs/proc/util.c
+++ b/
fs/proc/util.c
@@
-8,7
+8,7
@@
unsigned name_to_int(const struct qstr *qstr)
if (len > 1 && *name == '0')
goto out;
-
while (len-- > 0)
{
+
do
{
unsigned c = *name++ - '0';
if (c > 9)
goto out;
@@
-16,7
+16,7
@@
unsigned name_to_int(const struct qstr *qstr)
goto out;
n *= 10;
n += c;
- }
+ }
while (--len > 0);
return n;
out:
return ~0U;