* [PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call
@ 2014-08-09 23:48 Rickard Strandqvist
2014-08-11 10:55 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-08-09 23:48 UTC (permalink / raw)
To: Greg Kroah-Hartman, Oleg Drokin
Cc: Rickard Strandqvist, Peng Tao, Andreas Dilger, Alex Zhuravlev,
Christoph Jaeger, Hongchao Zhang, Lisa Nguyen, Masanari Iida,
Ann Koehler, devel, linux-kernel
Added a guaranteed null-terminate after call to strncpy.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/staging/lustre/lustre/obdclass/genops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 3210ad8..082b5b9 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -328,6 +328,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name)
result->obd_type = type;
strncpy(result->obd_name, name,
sizeof(result->obd_name) - 1);
+ result->obd_name[sizeof(result->obd_name) - 1] = '\0';
obd_devs[i] = result;
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call
2014-08-09 23:48 [PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call Rickard Strandqvist
@ 2014-08-11 10:55 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-08-11 10:55 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Greg Kroah-Hartman, Oleg Drokin, devel, Andreas Dilger,
Hongchao Zhang, Peng Tao, Alex Zhuravlev, linux-kernel,
Ann Koehler, Christoph Jaeger, Lisa Nguyen
On Sun, Aug 10, 2014 at 01:48:00AM +0200, Rickard Strandqvist wrote:
> Added a guaranteed null-terminate after call to strncpy.
>
No. This one isn't needed. The static checker *should* know this so it
is a problem with the static checker and not with the code.
Don't change code, just because the static checker has problems.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-11 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09 23:48 [PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call Rickard Strandqvist
2014-08-11 10:55 ` Dan Carpenter
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.