NR_KEYS caused the readKernelMapping function overflow issue in xserver/xorg/hw/kdrive/linux/keyboard.c

YongLi sdliyong at
Sun Aug 13 20:53:28 PDT 2006

Hello All,

I configured a Kdrive Xserver using the CVS code on X86 Debian system. However, I cannot launch the Xfbdev.

After debugging, I found this issue is caused by the NR_KEYS macro define. I have to modify this macro to 128.

After tarcing the code, I found the readKernelMapping function in keyboard.c has a overflow issue:

In line 140, if the ioctol fails, it will continue to the for loop. It cannot execute the two if statements in line 357.

I suggest to move the two if statements out of the for loop.

Anyone encounted the same problem?

Tyler Li

More information about the xorg mailing list