c
< 	upper = kmemdup(&entry[max + 1],
---
> 	if (max < (sizeof(entry) / sizeof(entry[0])) - 1) {
> 		upper = kmemdup(&entry[max + 1],
> 	} else {
> 		// Handle error: max is out of bounds
> 	}
