base: avoid warnings about shift operations

clang:
 warning: The result of the '<<' expression is undefined
This commit is contained in:
Alexander Boettcher
2018-10-25 11:42:11 +02:00
committed by Christian Helmuth
parent 4b62f091a9
commit 17f7147ac1
6 changed files with 29 additions and 4 deletions

View File

@ -178,6 +178,12 @@ void Capability_map::remove(Genode::addr_t const sel, uint8_t num_log_2,
while (last_sel > last_range) {
uint8_t left_log2 = log2(last_sel - last_range);
/* take care for a case which should not happen */
if (left_log2 >= sizeof(last_range)*8) {
error("cap remove error");
return;
}
remove(last_range, left_log2, revoke);
last_range += 1UL << left_log2;

View File

@ -40,8 +40,17 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
if (rcv_caps != ~0UL) {
/* calculate max order of caps to be received during reply */
unsigned short log2_max = rcv_caps ? log2(rcv_caps) : 0;
if ((1U << log2_max) < rcv_caps) log2_max ++;
unsigned short log2_max = 0;
if (rcv_caps) {
log2_max = log2(rcv_caps);
/* if this happens, the call is bogus and invalid */
if ((log2_max >= sizeof(rcv_caps) * 8))
throw Ipc_error();
if ((1UL << log2_max) < rcv_caps)
log2_max ++;
}
rcv_window.rcv_wnd(log2_max);
}