Skip to content

Commit

Permalink
sdio: check that addresses are within the address space
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
  • Loading branch information
Pierre Ossman committed Mar 24, 2009
1 parent c8d718f commit be6f19f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/mmc/core/sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
BUG_ON(!card);
BUG_ON(fn > 7);

/* sanity check */
if (addr & ~0x1FFFF)
return -EINVAL;

memset(&cmd, 0, sizeof(struct mmc_command));

cmd.opcode = SD_IO_RW_DIRECT;
Expand Down Expand Up @@ -125,6 +129,10 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
WARN_ON(blocks == 0);
WARN_ON(blksz == 0);

/* sanity check */
if (addr & ~0x1FFFF)
return -EINVAL;

memset(&mrq, 0, sizeof(struct mmc_request));
memset(&cmd, 0, sizeof(struct mmc_command));
memset(&data, 0, sizeof(struct mmc_data));
Expand Down

0 comments on commit be6f19f

Please sign in to comment.