From: Max Krummenacher Date: Wed, 5 Aug 2015 15:17:05 +0000 (+0200) Subject: tftp.c: fix CONFIG_TFTP_TSIZE for small files X-Git-Tag: KARO-TX6-2015-09-18~493 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=1f8434723ebbae4a1d95181e2b05a5e6dadfb02c;ds=sidebyside tftp.c: fix CONFIG_TFTP_TSIZE for small files CONFIG_TFTP_TSIZE should limit a tftp downloads progress to 50 '#' chars. Make this work also for small files. If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500. When using CONFIG TFTP BLOCKSIZE together with CONFIG_IP_DEFRAG the issue is more notable. Signed-off-by: Max Krummenacher Signed-off-by: Marcel Ziswiler Reviewed-by: Marek Vasut Acked-by: Joe Hershberger --- diff --git a/net/tftp.c b/net/tftp.c index 3e99e73091..89be32a26b 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -249,6 +249,8 @@ static void show_block_marker(void) if (tftp_tsize) { ulong pos = tftp_cur_block * tftp_block_size + tftp_block_wrap_offset; + if (pos > tftp_tsize) + pos = tftp_tsize; while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) { putc('#');