Re: [RFC][Patch] IBM Real-Time "SMI Free" mode driver

From: Alan Cox
Date: Wed Feb 11 2009 - 05:05:36 EST


> + /*get the address for the RTL table from the EBDA */
> + ebda_addr = *(unsigned short *)phys_to_virt(0x40E);
> + ebda_addr <<= 4;
> + ebda_size = 64*1024;

Second problem - you'll crash some systems with the assumptions here

> + for (i = 0 ; i < ebda_size/4; i++) {
> + unsigned int *tmp = (unsigned int *) data++;
> + if (*tmp == RTL_MAGIC_IDENT) {
> + table_addr = ebda_addr + i;
> + ret = rtl_setup_sysfs();
> + goto exit;
> + }
> + }

Some machines place the EBDA in the top pages of the low 640K. Your 64K
walk will continue into ISA MMIO space which isn't safe to blindly read.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/