pcmcia: fix ioport size calculation in rsrc_nonstatic

Size needs to be calculated after manipulating with the start value.

Reported-by: Komuro <komurojun-mbn@nifty.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2010-04-15 19:01:53 +02:00
parent b1095afe6f
commit 41b97ab505
1 changed files with 3 additions and 1 deletions

View File

@ -810,7 +810,7 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned
static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end) static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end)
{ {
struct socket_data *data = s->resource_data; struct socket_data *data = s->resource_data;
unsigned long size = end - start + 1; unsigned long size;
int ret = 0; int ret = 0;
#if defined(CONFIG_X86) #if defined(CONFIG_X86)
@ -820,6 +820,8 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
start = 0x100; start = 0x100;
#endif #endif
size = end - start + 1;
if (end < start) if (end < start)
return -EINVAL; return -EINVAL;