bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dd.c: code issue, assignment with no effect


From: Felix Rauch Valenti
Subject: dd.c: code issue, assignment with no effect
Date: Thu, 30 Mar 2006 18:30:40 +1100 (EST)

While working on a prototype for a static analysis tool, we found the
following issue in dd.c of coreutils version 5.94.

The assignment in the following line of the function iwrite() has no
effect (line number 755 of dd.c):
          nwritten = -1;

Right after the assignment is a 'break' statement, which exits the
while loop and also the scope of the variable 'nwritten'. Hence, the
assigned value of '-1' can never be used.

We do not know whether the assignment was inserted erroneously or
whether some other code was removed from the code that rendered the
assignment useless.

Please CC me for any followups, since I'm not subscribed to the list.

- Felix

--
Dr. Felix Rauch Valenti, Researcher      / felix.rauch (AT) nicta.com.au
Embedded, Real-Time & Operating Systems / Phone: +61 2 8306 0551
National ICT Australia (NICTA)         / Fax: +61 2 8306 0403
Room E608, Level 6, Building L5       / http://www.nicta.com.au/
UNSW, Sydney NSW 2052, Australia     / https://www.cse.unsw.edu.au/~frauch/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]