From patchwork Mon Aug 3 22:41:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Ziswiler X-Patchwork-Id: 503309 X-Patchwork-Delegate: trini@ti.com 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 4C3F11402E2 for ; Tue, 4 Aug 2015 08:44:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 35508A74F8; Tue, 4 Aug 2015 00:43:52 +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 a1-zfYjH8wsX; Tue, 4 Aug 2015 00:43:52 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E4878A7546; Tue, 4 Aug 2015 00:43:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C79E3A7506 for ; Tue, 4 Aug 2015 00:43:39 +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 RK_pn5XuMz-z for ; Tue, 4 Aug 2015 00:43:39 +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.194]) by theia.denx.de (Postfix) with ESMTPS id 3333DA749D for ; Tue, 4 Aug 2015 00:43:34 +0200 (CEST) Received: from localhost.net ([62.167.132.2]) by mrelay.perfora.net (mreueus001) with ESMTPSA (Nemesis) id 0MC2FC-1ZDYlO3fRA-008rlr; Tue, 04 Aug 2015 00:43:23 +0200 From: Marcel Ziswiler To: u-boot@lists.denx.de Date: Tue, 4 Aug 2015 00:41:34 +0200 Message-Id: X-Mailer: git-send-email 2.4.3 In-Reply-To: References: X-Provags-ID: V03:K0:T5w6BC+MlpBRM6x+psEioJT0x41PN25JqLCBrt5Q+qxKe3tTADg OehLhQU7nYAm/AqqpnlsmoScLD1LH9eaaEtaqpa5gDkD7d4c0munWMy5se5xQXAoRxdjzd7 1T0Q0Ic+xp/AT0qtut1OgYaffXIqzR3E97M7udrqBPzaq0FVyV1bIMH/JXekS3PIFUgH9ye GMquCb5uoFAr+4/UsMCQw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Z+Ayc4V7WuA=:9GXuRGM1/uy4xTdtUWnDUS qD3jduvCnhcKVDxiNy4R+yNQmGhXt2oqbY3XNfmn5eGa4ZZBfumXlx2sTIMI5JB9aDKpbSHQ9 XkA9bJeL0Jjjy8aJrrEqwTP/ZigIpOIL1jnxftoDI1cUYyaJehfDQqzoppJeF4uW3FcyWrxk8 69AmwL8NTu0Ca2IZaZevZP0yrDuMXB0hY9ms7Qd81QpbP88b2tEnXMiD7E46Yh69+8C1Bn2vY U4gHnEzyd0zZPPkHy7VVRdZ6rEOBQfzbNvjDVaPclrsbOB/KDJiWSeoX7h7yVH2HHkwOJhNBT O6qesrY3qWPqE1eKoVa+1R+OFXtGAoTzjtWZPvXDPHE0IHQ8D2ssWkCipByEmQVguofGPzp+f 00Ho+rgJ0Sr3yCj7ZP/+sls/eb+lFC31qwdVnz8WO6lt953N5CPL4FPHUNeoRwe4kySSgww8f c58G54J1/v9VB18nNd4mDlunDyXLxR2TB9yUh+MUDzi8Be2e6DRu0sx8h2ymxvqFcUcHnYNCS TQpz5VEqA6b9QiYXYDA0Rth3uMwIazI+keR+K8gU6+DXiL4mXRqKOgQEhLT3gp2falzlrwiRR 0YW4Pbpzj9CsXLVLxhOt9VVJSfLdLcFztF1jPh6MdfnEW5Lu99val0glv0gJyP5RXeK/2Vz2z 4OXf8svGVswSYnLU40/I0Lz+g Cc: Stefan Agner , Tom Rini , Marcel Ziswiler , Tom Warren , Max Krummenacher , Scott Wood , Stephen Warren , Marcel Ziswiler Subject: [U-Boot] [PATCH v4 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 Acked-by: Joe Hershberger --- Changes in v2: run it through checkpatch.pl and fix missing space in if clause as suggested by Marek net/tftp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tftp.c b/net/tftp.c index 3e99e73..89be32a 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('#');