[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/page: Implement {get, set}_pte_flags() as static inlines
commit e9cb0d1d0eb3a9e4d8b97432c9246cdfbb3b0309 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Sep 6 14:34:04 2017 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Sep 7 16:55:10 2017 +0100 x86/page: Implement {get,set}_pte_flags() as static inlines This resolves 11 Coverity issues along the lines of the following: 1600 for ( i = 0; i < NR_RESERVED_GDT_PAGES; i++ ) CID: Operands don't affect result (CONSTANT_EXPRESSION_RESULT)result_independent_of_operands: ((33U /* 1U | 0x20U */) | (({...}) ? 8388608U /* 1U << 23 */ : 0) | 0x40U | 2U) & 4095 is always 0x63 regardless of the values of its operands. This occurs as the bitwise second operand of "|". 1601 l1e_write(pl1e + FIRST_RESERVED_GDT_PAGE + i, 1602 l1e_from_pfn(mfn + i, __PAGE_HYPERVISOR_RW)); This is presumably because once preprocessed, the association of joint logic inside {get,set}_pte_flags() is lost. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/include/asm-x86/x86_64/page.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64/page.h index 1151ce9..6fb7cd5 100644 --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -121,8 +121,17 @@ typedef l4_pgentry_t root_pgentry_t; */ /* Extract flags into 24-bit integer, or turn 24-bit flags into a pte mask. */ -#define get_pte_flags(x) (((int)((x) >> 40) & ~0xFFF) | ((int)(x) & 0xFFF)) -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 40) | ((x) & 0xFFF)) +#ifndef __ASSEMBLY__ +static inline unsigned int get_pte_flags(intpte_t x) +{ + return ((x >> 40) & ~0xfff) | (x & 0xfff); +} + +static inline intpte_t put_pte_flags(unsigned int x) +{ + return (((intpte_t)x & ~0xfff) << 40) | (x & 0xfff); +} +#endif /* * Protection keys define a new 4-bit protection key field -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |