]> git.dujemihanovic.xyz Git - u-boot.git/commit
net: tftp: Fix tftp store address check in store_block()
authorBin Meng <bmeng.cn@gmail.com>
Sat, 16 Nov 2019 06:20:13 +0000 (22:20 -0800)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 9 Dec 2019 15:47:42 +0000 (09:47 -0600)
commitca48cb40283e2346603491a6214e95117c275f2f
tree64df34a1708aec49f050e6e3555cd42a8f1cedee
parent8524423da9afc637167057dd69e1f52f6dbcc8e5
net: tftp: Fix tftp store address check in store_block()

During testing of qemu-riscv32 with a 2GiB memory configuration,
tftp always fails with a error message:

  Load address: 0x84000000
  Loading: #
  TFTP error: trying to overwrite reserved memory...

It turns out the result of 'tftp_load_addr + tftp_load_size' just
overflows (0x100000000) and the test logic in store_block() fails.
Fix this by adjusting the end address to ULONG_MAX when overflow
is detected.

Fixes: a156c47e39ad ("tftp: prevent overwriting reserved memory")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/tftp.c