cleanup: Remove address space of returned pointer
PATCH 1/1 cleanup: Remove address space of returned pointer
Guard functions in local_lock.h are defined using DEFINE_GUARD() and DEFINE_LOCK_GUARD_1() macros having lock type defined as pointer in the percpu address space. The functions, defined by these macros return value in generic address space, causing:
cleanup.h:157:18: error: return from pointer to non-enclosed address space
and
cleanup.h:214:18: error: return from pointer to non-enclosed address space
when strict percpu checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
--- include/linux/cleanup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/cleanup.h +2 -2
@@ -290,7 +290,7 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \#define DEFINE_GUARD (_name, _type, _lock, _unlock) \ DEFINE_CLASS(_name, _type, if (_T) { _unlock; }, ({ _lock; _T; }), _type _T); \ static inline void * class_##_name##_lock_ptr(class_##_name##_t *_T) \ - { return *_T; } + { return (void *)(__force unsigned long)*_T; }#define DEFINE_GUARD_COND (_name, _ext, _condlock) \ EXTEND_CLASS(_name, _ext, \
@@ -347,7 +347,7 @@ static inline void class_##_name##_destructor(class_##_name##_t *_T) \ \ static inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \ { \ -return _T->lock; \ +return (void *)(__force unsigned long )_T->lock; \ }
Signature · 1 line
2.46.0
Quoted 11 lines · Uros Bizjak
Guard functions in
local_lock.hare defined usingDEFINE_GUARD()andDEFINE_LOCK_GUARD_1()macros having lock type defined as pointer in the percpu address space. The functions, defined by these macros return value in generic address space, causing:cleanup.h:157:18: error: return from pointer to non-enclosed address space
and
cleanup.h:214:18: error: return from pointer to non-enclosed address space
Quoted 8 lines
when strict percpu checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
Fixes e4ab322fbaaa ("cleanup: Add conditional guard support")Signed-off-by Uros Bizjak <[email protected]>
Thanks!
Now lives in queue locking/core, and barring robot screams will make its way into tip.
Quoted 19 lines · Peter Zijlstra
Quoted 17 lines · Uros Bizjak
Guard functions in
local_lock.hare defined usingDEFINE_GUARD()andDEFINE_LOCK_GUARD_1()macros having lock type defined as pointer in the percpu address space. The functions, defined by these macros return value in generic address space, causing:cleanup.h:157:18: error: return from pointer to non-enclosed address space
and
cleanup.h:214:18: error: return from pointer to non-enclosed address space
when strict percpu checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
Quoted 7 lines
Quoted 2 lines
Fixes e4ab322fbaaa ("cleanup: Add conditional guard support")Signed-off-by Uros Bizjak <[email protected]>Thanks!
Now lives in queue locking/core, and barring robot screams will make its way into tip.
I noticed that the patch was removed from the queue. Was there something wrong with it?
Uros.
Quoted 23 lines · Uros Bizjak
Quoted 22 lines · Peter Zijlstra
Quoted 19 lines · Uros Bizjak
Guard functions in
local_lock.hare defined usingDEFINE_GUARD()andDEFINE_LOCK_GUARD_1()macros having lock type defined as pointer in the percpu address space. The functions, defined by these macros return value in generic address space, causing:cleanup.h:157:18: error: return from pointer to non-enclosed address space
and
cleanup.h:214:18: error: return from pointer to non-enclosed address space
when strict percpu checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
Fixes e4ab322fbaaa ("cleanup: Add conditional guard support")Signed-off-by Uros Bizjak <[email protected]>
Quoted 7 lines
Quoted 4 lines
Thanks!
Now lives in queue locking/core, and barring robot screams will make its way into tip.
I noticed that the patch was removed from the queue. Was there something wrong with it?
Uhh.. damn. I thought I pushed things to tip, but instead I seem to have lost a bunch of patches.
Let me try and figure out what all went missing :/
Sorry, and thanks for noticing!
Quoted 4 lines · Peter Zijlstra
Uhh.. damn. I thought I pushed things to tip, but instead I seem to have lost a bunch of patches.
Let me try and figure out what all went missing :/
Just this patch it seems.. I restored it and hopefully I'll not loose it again.
The following commit has been merged into the locking/core branch of tip:
The following commit has been merged into the locking/core branch of tip:
Commit-ID: f730fd535fc51573f982fad629f2fc6b4a0cde2f Gitweb: https://git.kernel.org/tip/f730fd535fc51573f982fad629f2fc6b4a0cde2f Author: Uros Bizjak <[email protected]> AuthorDate: Mon, 19 Aug 2024 09:41:15 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 25 Oct 2024 10:01:50 +02:00
cleanup: Remove address space of returned pointer
Guard functions in local_lock.h are defined using DEFINE_GUARD() and DEFINE_LOCK_GUARD_1() macros having lock type defined as pointer in the percpu address space. The functions, defined by these macros return value in generic address space, causing:
cleanup.h:157:18: error: return from pointer to non-enclosed address space
and
cleanup.h:214:18: error: return from pointer to non-enclosed address space
when strict percpu checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
--- include/linux/cleanup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/cleanup.h +2 -2
@@ -290,7 +290,7 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \#define DEFINE_GUARD (_name, _type, _lock, _unlock) \ DEFINE_CLASS(_name, _type, if (_T) { _unlock; }, ({ _lock; _T; }), _type _T); \ static inline void * class_##_name##_lock_ptr(class_##_name##_t *_T) \ - { return *_T; } + { return (void *)(__force unsigned long)*_T; }#define DEFINE_GUARD_COND (_name, _ext, _condlock) \ EXTEND_CLASS(_name, _ext, \
@@ -347,7 +347,7 @@ static inline void class_##_name##_destructor(class_##_name##_t *_T) \ \ static inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \ { \ -return _T->lock; \ +return (void *)(__force unsigned long )_T->lock; \ }