j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
This patchset fixes up a couple of minor bugs found whilst developing the virtio driver (and should be considered a pre-requisite).
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Mark Cave-Ayland (2): ppc: fix va2pa() and pa2va() OF end range calculation libopenbios: don't allow find_package_method() to push a NULL for empty strings
arch/ppc/qemu/ofmem.c | 4 ++-- libopenbios/bindings.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-)
The value of OF_CODE_START + OF_CODE_SIZE overflows a 32-bit word causing translations within the OpenBIOS range to be incorrect.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- arch/ppc/qemu/ofmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/ppc/qemu/ofmem.c b/arch/ppc/qemu/ofmem.c index 7b8ced0..5a9cc87 100644 --- a/arch/ppc/qemu/ofmem.c +++ b/arch/ppc/qemu/ofmem.c @@ -222,7 +222,7 @@ void ofmem_arch_create_available_entry(phandle_t ph, ucell *availentry, phys_add phys_addr_t va2pa(unsigned long va) { - if (va >= OF_CODE_START && va < OF_CODE_START + OF_CODE_SIZE) { + if (va >= OF_CODE_START && va <= OF_CODE_START + OF_CODE_SIZE - 1) { return (phys_addr_t)get_rom_base() - OF_CODE_START + va; } else { return (phys_addr_t)va; @@ -233,7 +233,7 @@ unsigned long pa2va(phys_addr_t pa) { if ((pa - get_rom_base() + OF_CODE_START >= OF_CODE_START) && - (pa - get_rom_base() + OF_CODE_START < OF_CODE_START + OF_CODE_SIZE)) + (pa - get_rom_base() + OF_CODE_START <= OF_CODE_START + OF_CODE_SIZE - 1)) return (unsigned long)pa - get_rom_base() + OF_CODE_START; else return (unsigned long)pa;
Instead push a valid address with zero length otherwise the Forth find-method word can reference a NULL pointer.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- libopenbios/bindings.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libopenbios/bindings.c b/libopenbios/bindings.c index 4f7a993..926944d 100644 --- a/libopenbios/bindings.c +++ b/libopenbios/bindings.c @@ -161,7 +161,12 @@ my_self( void ) xt_t find_package_method( const char *method, phandle_t ph ) { - push_str( method ); + if (method == NULL) { + push_str(""); + } else { + push_str( method ); + } + PUSH_ph( ph ); fword("find-method"); if( POP() )