diff options
| author | 2008-09-30 14:05:32 -0700 | |
|---|---|---|
| committer | 2008-10-28 22:52:29 -0700 | |
| commit | 8ad324c971a14753c35f6135fa44dfe3c1a4bf82 (patch) | |
| tree | e68d775ac20c8718898c3431f2fcb06becd5ce44 | |
| parent | Protect against resource leaks. (diff) | |
Compare unsigned values instead of subtracting them.
Unsigned values do not return signed values when subtracted
and the right operand is larger then the left operand.
Signed-off-by: Dan Dennedy <dan@dennedy.org>
| -rw-r--r-- | src/fw.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1310,9 +1310,10 @@ fw_bandwidth_modify (raw1394handle_t handle, compare = ntohl (buffer); switch (mode) { case RAW1394_MODIFY_ALLOC: - swap = compare - bandwidth; - if (swap < 0) + if (compare < bandwidth) return -1; + + swap = compare - bandwidth; break; case RAW1394_MODIFY_FREE: |
