Stop iteration at the number of elements in the colors[] array when
initializing the elements.  Rather than a magic number.  This was found
by static analysis.

Signed-off-by: Zach Brown <[email protected]>
---
 btrfs-fragments.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/btrfs-fragments.c b/btrfs-fragments.c
index 4dd9470..cedbc57 100644
--- a/btrfs-fragments.c
+++ b/btrfs-fragments.c
@@ -283,7 +283,7 @@ list_fragments(int fd, u64 flags, char *dir)
                                white = gdImageColorAllocate(im, 255, 255, 255);
                                black = gdImageColorAllocate(im, 0, 0, 0);  
 
-                               for (j = 0; j < 10; ++j)
+                               for (j = 0; j < ARRAY_SIZE(colors); ++j)
                                        colors[j] = black;
 
                                init_colors(im, colors);
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to