Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: sbi: Fix 32/64 bits variable compatibility
On RV64,"unsigned long" is 64bit and "unsigned int" is 32bit. So in function "pmp_get" and "pmp_set", if "pmpcfg_shift >= 32", "0xff << pmpcfg_shift" will go beyond "unsigned int" width. This patch tries to fix this issue. In function 'pmp_get': cfgmask = (0xff << pmpcfg_shift); --> cfgmask = (0xffUL << pmpcfg_shift); In function 'pmp_set': cfgmask = ~(0xff << pmpcfg_shift); --> cfgmask = ~(0xffUL << pmpcfg_shift); Signed-off-by: Liush <[email protected]> Reviewed-by: Anup Patel <[email protected]>
- Loading branch information