All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390: scsi: zfcp_aux.c:  Cleaning up missing null-terminate after strncpy call
@ 2014-06-04 21:31 Rickard Strandqvist
  2014-06-04 21:59 ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-04 21:31 UTC (permalink / raw)
  To: Steffen Maier, linux390
  Cc: Rickard Strandqvist, Martin Schwidefsky, Heiko Carstens,
	linux-s390, linux-kernel

Added a guaranteed null-terminate after call to strncpy.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/s390/scsi/zfcp_aux.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 8004b07..138b84a 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -102,6 +102,7 @@ static void __init zfcp_init_device_setup(char *devstr)
 	if (!token || strlen(token) >= ZFCP_BUS_ID_SIZE)
 		goto err_out;
 	strncpy(busid, token, ZFCP_BUS_ID_SIZE);
+	busid[sizeof(busid) - 1] = '\0';
 
 	token = strsep(&str, ",");
 	if (!token || kstrtoull(token, 0, (unsigned long long *) &wwpn))
-- 
1.7.10.4

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

end of thread, other threads:[~2014-06-04 22:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04 21:31 [PATCH] s390: scsi: zfcp_aux.c: Cleaning up missing null-terminate after strncpy call Rickard Strandqvist
2014-06-04 21:59 ` Heiko Carstens
2014-06-04 22:22   ` Rickard Strandqvist

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.