TUD-OS / NRE

NOVA runtime environment (official branch)
GNU General Public License v2.0
33 stars 12 forks source link

Truncate offset in PCI config space #42

Closed parthy closed 11 years ago

parthy commented 11 years ago

https://github.com/TUD-OS/NRE/blob/master/nre/libs/libstdc%2B%2B/util/PCI.cc#L95

size_t has to be unsigned char or truncated manually to a valid offset.

blitz commented 11 years ago

This happens multiple times in this file. Basically whenever offset and conf_read are on the same line. ;)

Nils-TUD commented 11 years ago

hm...why is that size_t there anyway? That doesn't make any sense :/ I'll fix that. Thanks for pointing that out!

Nils-TUD commented 11 years ago

Ok, actually, size_t is correct, although it's strange at first. Because it's an offset in the PCI config space, i.e. for the pcicfg service and this takes an size_t as offset, because it is both used for the PCI config space and for the MM config space. But of course it's still wrong at this particular line, because the capability is just an uint8_t and the upper 24 bits are reserved.

Nils-TUD commented 11 years ago

Should be fixed now. Can anybody confirm that?

parthy commented 11 years ago

To see if this is the problem I already had it changed to unsigned char and it worked. So I bet this works, too ;)