x86/pkeys: Check against max pkey to avoid overflows
am: bfb55d4087

Change-Id: I2bae470cc94da4c9a321374c373fce4c76105954