lkml.org 
[lkml]   [2009]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][Patch] IBM Real-Time "SMI Free" mode drive -v2
> --- linux-2.6.32/drivers/misc/ibmrtl/ibm_rtl.c	1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.32-rtl/drivers/misc/ibmrtl/ibm_rtl.c 2009-12-14 16:37:19.000000000 -0800

Probably belongs in drivers/firmware as its not a misc_* interface user.

> + /* Get the address for the Extende Biso Data Area */
> + ebda_addr = *(u16 *) phys_to_virt(EDBA_ADDR);
> + ebda_addr <<= 4;
> + edba_map = ioremap(ebda_addr, 4);
> + if (!edba_map)
> + return -ENOMEM;

This is wrong. I wish we had a single proper EBDA handling function
because this keeps coming up.

The rules for the EBDA on PC class hardware as that the EBDA address
provides a real segment offset for the EBDA *if one is present*. Lots of
machines including quite a few suprisingly modern boxes (eg AMD76x
systems without a PS/2 mouse plugged in) don't have an EBDA so you need
to check if the word you read is zero before doing an ioremap.

> + for (table = (u32 *) edba_map ; \
> + table < (u32 *) edba_map + ebda_size/4; table++)

You need to check the table is valid and has a correct signature. Not
doing so is completely unsafe.

The rest of the code looks pretty sane to me.

Alan


\
 
 \ /
  Last update: 2009-12-16 01:03    [W:0.128 / U:26.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site