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>
This commit is contained in:
Erik Hovland 2008-09-30 14:05:32 -07:00 committed by Dan Dennedy
parent 709d8791ce
commit 8ad324c971
1 changed files with 3 additions and 2 deletions

View File

@ -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: