Skip to content

Commit 78c3d95

Browse files
melverpaulmckrcu
authored andcommitted
kcsan: Move ctx to start of argument list
It is clearer if ctx is at the start of the function argument list; it'll be more consistent when adding functions with varying arguments but all requiring ctx. No functional change intended. Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent d627c53 commit 78c3d95

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/kcsan/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static noinline void kcsan_check_scoped_accesses(void)
222222

223223
/* Rules for generic atomic accesses. Called from fast-path. */
224224
static __always_inline bool
225-
is_atomic(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx)
225+
is_atomic(struct kcsan_ctx *ctx, const volatile void *ptr, size_t size, int type)
226226
{
227227
if (type & KCSAN_ACCESS_ATOMIC)
228228
return true;
@@ -259,7 +259,7 @@ is_atomic(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx
259259
}
260260

261261
static __always_inline bool
262-
should_watch(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *ctx)
262+
should_watch(struct kcsan_ctx *ctx, const volatile void *ptr, size_t size, int type)
263263
{
264264
/*
265265
* Never set up watchpoints when memory operations are atomic.
@@ -268,7 +268,7 @@ should_watch(const volatile void *ptr, size_t size, int type, struct kcsan_ctx *
268268
* should not count towards skipped instructions, and (2) to actually
269269
* decrement kcsan_atomic_next for consecutive instruction stream.
270270
*/
271-
if (is_atomic(ptr, size, type, ctx))
271+
if (is_atomic(ctx, ptr, size, type))
272272
return false;
273273

274274
if (this_cpu_dec_return(kcsan_skip) >= 0)
@@ -637,7 +637,7 @@ check_access(const volatile void *ptr, size_t size, int type, unsigned long ip)
637637
else {
638638
struct kcsan_ctx *ctx = get_ctx(); /* Call only once in fast-path. */
639639

640-
if (unlikely(should_watch(ptr, size, type, ctx)))
640+
if (unlikely(should_watch(ctx, ptr, size, type)))
641641
kcsan_setup_watchpoint(ptr, size, type, ip);
642642
else if (unlikely(ctx->scoped_accesses.prev))
643643
kcsan_check_scoped_accesses();

0 commit comments

Comments
 (0)