Skip to contentSkip to conversation

checks: Use proper format modifier for size_t

PATCH Applied Thierry Reding 3 participants 3 messages Sep 27, 2017 – Sep 28, 2017 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checks: Use proper format modifier for size_t

From: Thierry Reding <[email protected]>

The size of size_t can vary between architectures, so using %ld isn't going to work on 32-bit builds. Use the %zu modifier to make sure it is always correct.

---
 checks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
checks.c +2 -2
index 902f2e374025..08a3a29edae3 100644
@@ -972,7 +972,7 @@ static void check_property_phandle_args(struct check *c,
 	int cell, cellsize = 0;
 
 	if (prop->val.len % sizeof(cell_t)) {
-		FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s",
+		FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s",
 		     prop->name, prop->val.len, sizeof(cell_t), node->fullpath);
 		return;
 	}
@@ -1163,7 +1163,7 @@ static void check_interrupts_property(struct check *c,
 		return;
 
 	if (irq_prop->val.len % sizeof(cell_t))
-		FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s",
+		FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s",
 		     irq_prop->name, irq_prop->val.len, sizeof(cell_t),
 		     node->fullpath);
 
Signature · 1 line
2.14.1

A message that is not in the archive (sent off-list or not yet received): 20170927130409.9092-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by
#2 lore raw
Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The size of size_t can vary between architectures, so using %ld isn't going to work on 32-bit builds. Use the %zu modifier to make sure it is always correct.

Crap, I did it again. %z was wrong last time, but appears to be correct here since we are in fact dealing with a size_t here.

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_Jsq+egwxhx+9KxwQJBrYsBGMSV+NDmdBzWMfTs2Y0VE4Miw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Applied
#4 lore raw
Quoted 4 lines · Rob Herring
Quoted 2 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Quoted 8 lines
Quoted 3 lines

The size of size_t can vary between architectures, so using %ld isn't going to work on 32-bit builds. Use the %zu modifier to make sure it is always correct.

Crap, I did it again. %z was wrong last time, but appears to be correct here since we are in fact dealing with a size_t here.

Applied, thanks.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson