fs-proc-kcorec-remove-check-of-list-iterator-against-head-past-the-loop-body.patch removed from -mm tree
The quilt patch titled
Subject: fs/proc/kcore.c: remove check of list iterator against head past the loop body
has been removed from the -mm tree. Its filename was
fs-proc-kcorec-remove-check-of-list-iterator-against-head-past-the-loop-body.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Jakob Koschel <[email protected]>
Subject: fs/proc/kcore.c: remove check of list iterator against head past the loop body
When list_for_each_entry() completes the iteration over the whole list without breaking the loop, the iterator value will be a bogus pointer computed based on the head element.
While it is safe to use the pointer to determine if it was computed based on the head element, either with list_entry_is_head() or &pos->member == head, using the iterator variable after the loop should be avoided.
In preparation to limit the scope of a list iterator to the list traversal loop, use a dedicated pointer to point to the found element [1].
---
fs/proc/kcore.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/proc/kcore.c renamed from fs/proc/kcore.c~fs-proc-kcorec-remove-check-of-list-iterator-against-head-past-the-loop-body +9 -5
@@ -479,10 +479,15 @@ read_kcore(struct file *file, char __use* the previous entry, search for a matching entry. */ if (!m || start < m->addr || start >= m->addr + m->size) { -list_for_each_entry (m, &kclist_head, list) { -if (start >= m->addr && - start < m->addr + m->size) +struct kcore_list *iter; + + m =NULL ; +list_for_each_entry (iter, &kclist_head, list) { +if (start >= iter->addr && + start < iter->addr + iter->size) { + m = iter;break ; + } } }
@@ -492,12 +497,11 @@ read_kcore(struct file *file, char __usepage_offline_freeze (); } -if (&m->list == &kclist_head) { +if (!m) {if (clear_user (buffer, tsz)) { ret = -EFAULT ; goto out; } - m =NULL ;/* skip the list anchor */ goto skip; }
_
Patches currently in -mm which might be from [email protected] are