Sometimes the static inline functions provided by DECLARE_BOUNDS cannot
be used. This patch uses explicit casts to uintptr_t in those cases.
M3CM: Rule-18.2: Subtraction between pointers shall only be applied to
pointers that address elements of the same array
https://wiki.sei.cmu.edu/confluence/display/c/ARR36-C.+Do+not+subtract+or+compare+two+pointers+that+do+not+refer+to+the+same+array
QAVerify: 2761
Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
CC: JBeulich@suse.com
CC: andrew.cooper3@citrix.com
* respective reserve_e820_ram() invocation below.
*/
mod[mbi->mods_count].mod_start = virt_to_mfn(_stext);
- mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext;
+ mod[mbi->mods_count].mod_end = (uintptr_t)__2M_rwdata_end -
+ (uintptr_t) _stext;
}
modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
const struct bug_frame *s;
s = bug_frames[i - 1];
- sz = bug_frames[i] - s;
+ /* bug_frame[i] and s are pointers to different objects. */
+ sz = ((uintptr_t)bug_frames[i] - (uintptr_t)s) /
+ sizeof(struct bug_frame);
core.frame[i - 1].n_bugs = sz;
core.frame[i - 1].bugs = s;