LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] locomo.c: convert strncpy(x, y, sizeof(x)) to strlcpy
@ 2008-03-06 13:08 Roel Kluin
  2008-03-06 21:44 ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2008-03-06 13:08 UTC (permalink / raw)
  To: elf; +Cc: Linux-arm, lkml

This patch was not yet tested. Please confirm it's right.
---
strncpy does not append '\0' if the length of the source string equals
the size parameter, strlcpy does.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index ae21755..89b2328 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -516,7 +516,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
 		goto out;
 	}
 
-	strncpy(dev->dev.bus_id, info->name, sizeof(dev->dev.bus_id));
+	strlcpy(dev->dev.bus_id, info->name, sizeof(dev->dev.bus_id));
 	/*
 	 * If the parent device has a DMA mask associated with it,
 	 * propagate it down to the children.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-07  2:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06 13:08 [PATCH] locomo.c: convert strncpy(x, y, sizeof(x)) to strlcpy Roel Kluin
2008-03-06 21:44 ` H. Peter Anvin
2008-03-06 23:35   ` Roel Kluin
2008-03-07  1:51     ` David Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).