static ulong tftp_block_wrap_offset;
static int tftp_state;
static ulong tftp_load_addr;
-static ulong tftp_load_size;
#ifdef CONFIG_TFTP_TSIZE
/* The file size reported by the server */
static int tftp_tsize;
void *ptr;
if (CONFIG_IS_ENABLED(LMB)) {
- ulong end_addr = tftp_load_addr + tftp_load_size;
-
- if (!end_addr)
- end_addr = ULONG_MAX;
-
if (store_addr < tftp_load_addr ||
- store_addr + len > end_addr) {
+ lmb_read_check(store_addr, len)) {
puts("\nTFTP error: ");
puts("trying to overwrite reserved memory...\n");
return -1;
}
}
-/* Initialize tftp_load_addr and tftp_load_size from image_load_addr and lmb */
static int tftp_init_load_addr(void)
{
- if (CONFIG_IS_ENABLED(LMB)) {
- phys_size_t max_size;
-
- max_size = lmb_get_free_size(image_load_addr);
- if (!max_size)
- return -1;
-
- tftp_load_size = max_size;
- }
-
tftp_load_addr = image_load_addr;
return 0;
}