projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net: mdio-uclass: rename arguments of dm_mdio_phy_connect for clarity
[oweals/u-boot.git]
/
net
/
tftp.c
diff --git
a/net/tftp.c
b/net/tftp.c
index eca801aa194eb7fb71b5ed8f1de31faaf12f3502..1e3c18ae69c0f975e22383fcdcba18bcee0eec38 100644
(file)
--- a/
net/tftp.c
+++ b/
net/tftp.c
@@
-9,6
+9,7
@@
#include <common.h>
#include <command.h>
#include <efi_loader.h>
#include <common.h>
#include <command.h>
#include <efi_loader.h>
+#include <env.h>
#include <mapmem.h>
#include <net.h>
#include <net/tftp.h>
#include <mapmem.h>
#include <net.h>
#include <net/tftp.h>
@@
-170,8
+171,13
@@
static inline int store_block(int block, uchar *src, unsigned int len)
void *ptr;
#ifdef CONFIG_LMB
void *ptr;
#ifdef CONFIG_LMB
+ ulong end_addr = tftp_load_addr + tftp_load_size;
+
+ if (!end_addr)
+ end_addr = ULONG_MAX;
+
if (store_addr < tftp_load_addr ||
if (store_addr < tftp_load_addr ||
- store_addr + len >
tftp_load_addr + tftp_load_size
) {
+ store_addr + len >
end_addr
) {
puts("\nTFTP error: ");
puts("trying to overwrite reserved memory...\n");
return -1;
puts("\nTFTP error: ");
puts("trying to overwrite reserved memory...\n");
return -1;
@@
-606,8
+612,7
@@
static int tftp_init_load_addr(void)
struct lmb lmb;
phys_size_t max_size;
struct lmb lmb;
phys_size_t max_size;
- lmb_init_and_reserve(&lmb, gd->bd->bi_dram[0].start,
- gd->bd->bi_dram[0].size, (void *)gd->fdt_blob);
+ lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
max_size = lmb_get_free_size(&lmb, load_addr);
if (!max_size)
max_size = lmb_get_free_size(&lmb, load_addr);
if (!max_size)