mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
ANDROID: arm64: Disallow use of backported SYS_FIELD_*() access macros
These are dangerous because they assume mask macros are pre-shifted,
GENMASK style. Most of the masks in this kernel tree are not shifted.
Avoid accidental buggy backports in future by turning the SYS_FIELD
accessors into BUILD_BUG().
Signed-off-by: Keir Fraser <keirf@google.com>
Bug: 233588291
Fixes: 1bf4f91abe ("UPSTREAM: arm64/sysreg: Introduce helpers for access to sysreg fields")
Change-Id: I647a66d59279e69c916f66b42705fc20cd256fa8
This commit is contained in:
@@ -1430,14 +1430,20 @@
|
||||
par; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Disallow any use of the following backported SYS_FIELD macros. They rely on
|
||||
* use of pre-shifted masked (for example, as generated by GENMASK). Most of
|
||||
* the masks defined in this tree are not shifted, making these macros subtly
|
||||
* dangerous!
|
||||
*/
|
||||
#define SYS_FIELD_GET(reg, field, val) \
|
||||
FIELD_GET(reg##_##field##_MASK, val)
|
||||
BUILD_BUG()
|
||||
|
||||
#define SYS_FIELD_PREP(reg, field, val) \
|
||||
FIELD_PREP(reg##_##field##_MASK, val)
|
||||
BUILD_BUG()
|
||||
|
||||
#define SYS_FIELD_PREP_ENUM(reg, field, val) \
|
||||
FIELD_PREP(reg##_##field##_MASK, reg##_##field##_##val)
|
||||
BUILD_BUG()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user