Skip to contentSkip to conversation

pci_br: fix a signedness bug

PATCH New Dan Carpenter 1 participant 1 message Aug 4, 2016 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci_br: fix a signedness bug

ate_resource->lowest_free_index is unsigned so it's never less than zero. I've changed it to test for = -1. This happens when there aren't any free ates left.

---
I can't compile this actually...

arch/ia64/sn/pci/pcibr/pcibr_ate.c +2 -2
index 5bc34ea..024ae9b 100644
@@ -71,7 +71,7 @@ static inline void free_ate_resource(struct ate_resource *ate_resource,
 {
 	mark_ate(ate_resource, start, ate_resource->ate[start], 0);
 	if ((ate_resource->lowest_free_index > start) ||
-	    (ate_resource->lowest_free_index < 0))
+	    (ate_resource->lowest_free_index = -1))
 		ate_resource->lowest_free_index = start;
 }
 
@@ -86,7 +86,7 @@ static inline int alloc_ate_resource(struct ate_resource *ate_resource,
 	/*
 	 * Check for ate exhaustion.
 	 */
-	if (ate_resource->lowest_free_index < 0)
+	if (ate_resource->lowest_free_index = -1)
 		return -1;
 
 	/*