xenvm: evtchn: fix undefined value during event handling
This commit fixes issue with undefined value during position calculations. Shift for positions may be >32, so we need to explicitly use unsigned long casting to prevent unexpected behavior during event handling. Thanks @jgrall for suggestion. Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit is contained in:
parent
5f4fd311fc
commit
d48f99f01f
1 changed files with 2 additions and 2 deletions
|
@ -227,12 +227,12 @@ static void events_isr(void *data)
|
||||||
while (pos_selector) {
|
while (pos_selector) {
|
||||||
/* Find first position, clear it in selector and process */
|
/* Find first position, clear it in selector and process */
|
||||||
pos_index = __builtin_ffsl(pos_selector) - 1;
|
pos_index = __builtin_ffsl(pos_selector) - 1;
|
||||||
pos_selector &= ~(1 << pos_index);
|
pos_selector &= ~(((xen_ulong_t) 1) << pos_index);
|
||||||
|
|
||||||
/* Find all active evtchn on selected position */
|
/* Find all active evtchn on selected position */
|
||||||
while ((events_pending = get_pending_events(pos_index)) != 0) {
|
while ((events_pending = get_pending_events(pos_index)) != 0) {
|
||||||
event_index = __builtin_ffsl(events_pending) - 1;
|
event_index = __builtin_ffsl(events_pending) - 1;
|
||||||
events_pending &= (1 << event_index);
|
events_pending &= (((xen_ulong_t) 1) << event_index);
|
||||||
|
|
||||||
port = (pos_index * 8 * sizeof(xen_ulong_t))
|
port = (pos_index * 8 * sizeof(xen_ulong_t))
|
||||||
+ event_index;
|
+ event_index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue