You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
FROMLIST: lib/list_sort: fix function type mismatches
Casting the comparison function to a different type trips indirect call
Control-Flow Integrity (CFI) checking. Remove the additional consts from
cmp_func, and the now unneeded casts.
Bug: 145210207
Change-Id: Iffe0eeec8e7f65a5937513a4bb87e5107faa004e
Link: https://lore.kernel.org/lkml/20200110225602.91663-1-samitolvanen@google.com/
Fixes: 043b3f7b63 ("lib/list_sort: simplify and remove MAX_LIST_LENGTH_BITS")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
committed by
Alistair Delva
parent
e97c57662c
commit
d54ee8a555
@@ -8,7 +8,7 @@
|
||||
#include <linux/list.h>
|
||||
|
||||
typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *,
|
||||
struct list_head const *, struct list_head const *);
|
||||
struct list_head *, struct list_head *);
|
||||
|
||||
/*
|
||||
* Returns a list organized in an intermediate format suited
|
||||
@@ -227,7 +227,7 @@ void list_sort(void *priv, struct list_head *head,
|
||||
if (likely(bits)) {
|
||||
struct list_head *a = *tail, *b = a->prev;
|
||||
|
||||
a = merge(priv, (cmp_func)cmp, b, a);
|
||||
a = merge(priv, cmp, b, a);
|
||||
/* Install the merged result in place of the inputs */
|
||||
a->prev = b->prev;
|
||||
*tail = a;
|
||||
@@ -249,10 +249,10 @@ void list_sort(void *priv, struct list_head *head,
|
||||
|
||||
if (!next)
|
||||
break;
|
||||
list = merge(priv, (cmp_func)cmp, pending, list);
|
||||
list = merge(priv, cmp, pending, list);
|
||||
pending = next;
|
||||
}
|
||||
/* The final merge, rebuilding prev links */
|
||||
merge_final(priv, (cmp_func)cmp, head, pending, list);
|
||||
merge_final(priv, cmp, head, pending, list);
|
||||
}
|
||||
EXPORT_SYMBOL(list_sort);
|
||||
|
||||
Reference in New Issue
Block a user