mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-10 05:46:07 +00:00
The 'tail' and 'head' are 'unsigned int' type free-running count, when
'head' is overflow, the 'int i (= tail) < u32 head' will be false:
Only '- loop 0: idx = 63' result is shown, so it needs to use 'int' type
to compare, it can handle the overflow correctly.
typedef uint32_t u32;
int main()
{
u32 tail, head;
int stail, shead;
int i, loop;
tail = 0xffffffff;
head = 0x00000000;
for (i = tail, loop = 0; i < head; i++) {
unsigned int idx = i & 63;
printf("+ loop %d: idx = %u\n", loop++, idx);
}
stail = tail;
shead = head;
for (i = stail, loop = 0; i < shead; i++) {
unsigned int idx = i & 63;
printf("- loop %d: idx = %u\n", loop++, idx);
}
return 0;
}
Fixes:
|
||
|---|---|---|
| .. | ||
| gve_adminq.c | ||
| gve_adminq.h | ||
| gve_desc_dqo.h | ||
| gve_desc.h | ||
| gve_dqo.h | ||
| gve_ethtool.c | ||
| gve_main.c | ||
| gve_register.h | ||
| gve_rx_dqo.c | ||
| gve_rx.c | ||
| gve_tx_dqo.c | ||
| gve_tx.c | ||
| gve_utils.c | ||
| gve_utils.h | ||
| gve.h | ||
| Makefile | ||