The patch titled Subject: fs/proc/base.c: save decrement during lookup/readdir in /proc/$PID has been added to the -mm tree. Its filename is proc-save-decrement-during-lookup-readdir-in-proc-pid.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/proc-save-decrement-during-lookup-readdir-in-proc-pid.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/proc-save-decrement-during-lookup-readdir-in-proc-pid.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Alexey Dobriyan <adobriyan@xxxxxxxxx> Subject: fs/proc/base.c: save decrement during lookup/readdir in /proc/$PID Comparison for "<" works equally well as comparison for "<=" but one SUB/LEA is saved (no, it is not optimised away, at least here). Link: http://lkml.kernel.org/r/20161122195143.GA29812@avx2 Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff -puN fs/proc/base.c~proc-save-decrement-during-lookup-readdir-in-proc-pid fs/proc/base.c --- a/fs/proc/base.c~proc-save-decrement-during-lookup-readdir-in-proc-pid +++ a/fs/proc/base.c @@ -2412,14 +2412,14 @@ static struct dentry *proc_pident_lookup * Yes, it does not scale. And it should not. Don't add * new entries into /proc/<tgid>/ without very good reasons. */ - last = &ents[nents - 1]; - for (p = ents; p <= last; p++) { + last = &ents[nents]; + for (p = ents; p < last; p++) { if (p->len != dentry->d_name.len) continue; if (!memcmp(dentry->d_name.name, p->name, p->len)) break; } - if (p > last) + if (p >= last) goto out; error = proc_pident_instantiate(dir, dentry, task, p); @@ -2444,7 +2444,7 @@ static int proc_pident_readdir(struct fi if (ctx->pos >= nents + 2) goto out; - for (p = ents + (ctx->pos - 2); p <= ents + nents - 1; p++) { + for (p = ents + (ctx->pos - 2); p < ents + nents; p++) { if (!proc_fill_cache(file, ctx, p->name, p->len, proc_pident_instantiate, task, p)) break; _ Patches currently in -mm which might be from adobriyan@xxxxxxxxx are kbuild-simpler-generation-of-assembly-constants.patch scripts-bloat-o-meter-dont-use-readlines.patch scripts-bloat-o-meter-compile-number-regex.patch proc-make-struct-pid_entry-len-unsigned.patch proc-make-struct-struct-map_files_info-len-unsigned-int.patch proc-just-list_del-struct-pde_opener.patch proc-fix-type-of-struct-pde_opener-closing-field.patch proc-kmalloc-struct-pde_opener.patch proc-tweak-comments-about-2-stage-open-and-everything.patch proc-save-decrement-during-lookup-readdir-in-proc-pid.patch coredump-clarify-unsafe-core_pattern-warning.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html