From patchwork Wed Jul 1 23:04:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Ziswiler X-Patchwork-Id: 490399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 16FCA1402B3 for ; Thu, 2 Jul 2015 09:12:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B74564B622; Thu, 2 Jul 2015 01:12:23 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Aa5VhrmRlbjV; Thu, 2 Jul 2015 01:12:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 47D964A03A; Thu, 2 Jul 2015 01:12:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 096634A03A for ; Thu, 2 Jul 2015 01:12:20 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U78LNtwWNf1j for ; Thu, 2 Jul 2015 01:12:19 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mout.perfora.net (mout.perfora.net [74.208.4.197]) by theia.denx.de (Postfix) with ESMTPS id 913134A01C for ; Thu, 2 Jul 2015 01:12:19 +0200 (CEST) Received: from localhost.localdomain ([89.217.117.82]) by mrelay.perfora.net (mreueus003) with ESMTPSA (Nemesis) id 0MOyzh-1Z5kO73ayN-006Kb5; Thu, 02 Jul 2015 01:06:09 +0200 From: Marcel Ziswiler To: u-boot@lists.denx.de Date: Thu, 2 Jul 2015 01:04:53 +0200 Message-Id: <4c4c29ae74120a1829e496ec03a27a7220d74c9d.1435791392.git.marcel.ziswiler@toradex.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: X-Provags-ID: V03:K0:aVkLaIYppZqQ2vEfZtRFsKh0ib75S1qjlx0TV+1EVeluWNxMiJ2 hyxHkfIFpMLU7c3P3aBWP5HANuBK1LkeF2SAak0ZewYLShBuLcZna3JI9Adldow5OwIxkv0 PS6wUU+dwGeQhBvqm1cEmywP7pv2d2yLdveu+DxfFeXodTDTwTeso53MLuXhVaBVA5oGUqg XpMsOGZqM37UWfq5LWBgg== X-UI-Out-Filterresults: notjunk:1; V01:K0:d902tkX5dCw=:41S8rugymppH93bar6puPJ Vh+MBhbPtbi8jOzz1rUTEbPxBYn2YdBwXGKcRhPr/761floIS55xcPc15njse74Kc9/4dHHl0 QbA0pQSZoAWyNihpXvgWgCJJ+ni5vYJuyBgVZrUMkWDJfvrYVzRknmZFWfa0Sq09idfRtdRpq KiN2gfVdS5jlL+0ii7jrfBajjToBSBTzLjTS65yu1pp3WcrXazgQc00sV59U++dKYQqBkqN+g EC8EcnmVCik/isrldIlhCfgc1jvWKRVnP3gqEauQSJ1GiTRpGlhY8MZxulovAzXvnLmSfC0kH VKel3B7HrnhTio+Uxcx5Cns8vPEC38TQy+x8I42kpph/qtMD4Lf1epA5IKJCDBKZwsnmyOQ60 z4O+u4A1nfpE9IKjrHeVOOaxlstF02YH2hifVxvqO6Wcks8o8iCRj7hjA2/41Q+NiLbGp39My OkpelokbGWh5VpSrrNgABrzJVoxNAcs0yhLb7S9/8i6WxGz3ojv8PMSWL7L6DHTxjvZ4hGgic Xh1mNMep2uSI7JGss1K7eR472vd4REB0UWXAZXLk6UR8Fnmn9g/AgHXSWQ9tz12ugTZ/uagXp WOvoLXsdzpo0+O4WXhlCo7C9JC9g6qotpAEhR0C3nYsIRzObToScJB2qc/IGflMeIXH48x7ie 4laXlZNt0zQb68wMS46A/Vawb Cc: Marek Vasut , Tom Rini , Stefan Agner , Marcel Ziswiler , Masahiro Yamada , Joe Hershberger , Max Krummenacher , Scott Wood Subject: [U-Boot] [PATCH 8/8] tftp.c: fix CONFIG_TFTP_TSIZE for small files X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Max Krummenacher 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 --- net/tftp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tftp.c b/net/tftp.c index 3e99e73..1853fe7 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('#');