Skip to contentSkip to conversation

tftp: fix type of block arg to store_block

PATCH Superseded Wolfgang Denk 1 participant 1 message Jun 6, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1338961566-13389-1-git-send-email-jayachandranc@netlogicmicro.com

#1 lore raw

PATCH 1/1 tftp: fix type of block arg to store_block

Dear "Jayachandran C",

Quoted 3 lines · In message <1338961566-13389-1-git-send-email-jayachandranc@netlogicmicro.com>…

The block argument for store_block can be -1 when the tftp sequence number rolls over (i.e TftpBlock == 0), so the first argument to store_block has to be of type 'int' instead of 'unsigned'.

What makes you think so?

Review

Quoted 4 lines
(quoted diff) +1 -1
-store_block (unsigned block, uchar * src, unsigned len)
+store_block (int block, uchar * src, unsigned len)
 {
 	ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;

Block gets used to compute the offset into the storage area, so it must never be negative.

I think your analysis must be flawed.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Making files is easy under  the  UNIX  operating  system.  Therefore,
users  tend  to  create  numerous  files  using large amounts of file
space. It has been said that the only standard thing about  all  UNIX
systems  is  the  message-of-the-day  telling users to clean up their
files.                             - System V.2 administrator's guide