« Previous | Next » 

Revision 3e48dd4a

ID3e48dd4a2d48aabafe22ce3611d65544d0234a69

Added by Stefan Hajnoczi about 12 years ago

rtl8139: do not assume TxStatus[] and TxAddr[] are adjacent

Commit afe0a595356192d5f79703cf6462fcc112df007c ("rtl8139: support byte
read to TxStatus registers") reused rtl8139_TxStatus_read() for reading
TxAddr registers. It relies on the fact that TxStatus[] and TxAddr[]
are adjacent.

This causes a gcc warning because the compiler can detect that array
access is out-of-bounds:

hw/rtl8139.c:2501:27: error: array subscript is above array bounds [-Werror=array-bounds]

This patch refactors the function so that we don't rely on out-of-bounds
accesses.

Cc: Jason Wang <>
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Anthony Liguori <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences