On 7/11/25 15:03, Jan Beulich wrote: > On 11.07.2025 13:43, Dmytro Prokopchuk1 wrote: >> --- a/xen/common/memory.c >> +++ b/xen/common/memory.c >> @@ -773,7 +773,7 @@ static long >> memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg) >> >> nrspin_lock(&d->page_alloc_lock); >> drop_dom_ref = (dec_count && >> - !domain_adjust_tot_pages(d, -dec_count)); >> + !domain_adjust_tot_pages(d, >> -(long)dec_count)); > > Here and elsewhere I continue to think that we would better avoid casts > in such cases as well, just like we try to minimize their use everywhere > else. Got it!
> >> --- a/xen/common/time.c >> +++ b/xen/common/time.c >> @@ -84,7 +84,7 @@ struct tm gmtime(unsigned long t) >> } >> tbuf.tm_year = y - 1900; >> tbuf.tm_yday = days; >> - ip = (const unsigned short int *)__mon_lengths[__isleap(y)]; >> + ip = (const unsigned short int *)__mon_lengths[__isleap(y) ? 1 : 0]; > > If an expression is needed here, I'd suggest to use !!, as we have in > (luckily decreasing) number of places elsewhere. Personally I don't > understand though why a boolean cannot be used as an array index. > >> --- a/xen/drivers/passthrough/arm/smmu-v3.c >> +++ b/xen/drivers/passthrough/arm/smmu-v3.c >> @@ -315,7 +315,7 @@ static int queue_poll_cons(struct arm_smmu_queue *q, >> bool sync, bool wfe) >> >> while (queue_sync_cons_in(q), >> (sync ? !queue_empty(&q->llq) : queue_full(&q->llq))) { >> - if ((NOW() > timeout) > 0) >> + if (NOW() > timeout) >> return -ETIMEDOUT; > > How does this change fit here? > > Jan if ((NOW() > timeout) > 0) Result of "(NOW() > timeout)" is Boolean, so we have comparison Boolean with Numeric value.