Message ID | 1QCSeq-0004h5-4Z@wolf.netmodule.com |
---|---|
State | Changes Requested |
Headers | show |
Hi David, > I had a problem with an old TFTP Server which is sending a second "last" > data block with "len == 0" at end. It's clearly not RFC conform, but I > still made a additional check in u-boot/tftp to avoid a wrong "filesize" > value. This wrong filesize value caused some trouble by NAND operations. Please look at our patch guidelines[1] on how to submit patches. Especially a signed-off-by is missing on this patch. Moreover, please put the explanation into the commit log so that one can learn the rationale for the change when studying the source with git. Thanks Detlev [1] http://www.denx.de/wiki/U-Boot/Patches
diff --git a/net/tftp.c b/net/tftp.c index ed559b7..40d81b5 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -135,8 +135,14 @@ mcast_cleanup(void) static __inline__ void store_block (unsigned block, uchar * src, unsigned len) { - ulong offset = block * TftpBlkSize + TftpBlockWrapOffset; - ulong newsize = offset + len; + ulong offset = 0; + ulong newsize = 0; + + if (len == 0) + return; + + offset = block * TftpBlkSize + TftpBlockWrapOffset; + newsize = offset + len; #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP int i, rc = 0;