diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2010-07-16 16:25:53 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-07-16 16:25:53 -0700 |
commit | 055f763ca8c0eb69724cf5c1e5cb9511dce724f9 (patch) | |
tree | 0adebfec7e1eb0499df93f36e4793bd8d2539aef /core | |
parent | 21af78ff343844210a2241daa1b040c9d3c72178 (diff) | |
download | syslinux-055f763ca8c0eb69724cf5c1e5cb9511dce724f9.tar.gz |
diskio: check early for an impossible LBA value for CHS requests
Make sure we don't end up trying to do a CHS request for a truly
absurd value, that could possibly be misconverted.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/fs/diskio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/fs/diskio.c b/core/fs/diskio.c index 822314c5..cf9bf499 100644 --- a/core/fs/diskio.c +++ b/core/fs/diskio.c @@ -25,6 +25,9 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf, int retry; uint32_t maxtransfer = disk->maxtransfer; + if (lba + disk->part_start >= 1024*256*63) + return 0; /* Impossible CHS request */ + memset(&ireg, 0, sizeof ireg); ireg.eax.b[1] = 0x02 + is_write; |