From 8ad324c971a14753c35f6135fa44dfe3c1a4bf82 Mon Sep 17 00:00:00 2001 From: Erik Hovland Date: Tue, 30 Sep 2008 14:05:32 -0700 Subject: [PATCH] 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 --- src/fw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fw.c b/src/fw.c index a229d1a..9c0c2e9 100644 --- a/src/fw.c +++ b/src/fw.c @@ -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: