aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>2014-07-27 11:11:18 -0400
committerChristoph Hellwig <hch@lst.de>2015-01-09 09:44:21 -0500
commit2195d9690464445d0c30ee8170030a8e696f2053 (patch)
tree78b23c3ffd65f7a12bb14992231b92521a44ae12
parentacafd0b920e1a4a94a03f1911b4fb87e2081f235 (diff)
3w-9xxx.c: Cleaning up missing null-terminate in conjunction with strncpy
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. And use the sizeof on the to string rather than strlen on the from string. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Acked-by: Adam Radford <aradford@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/3w-9xxx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index cd4129ff7ae4..7600639db4c4 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -608,7 +608,8 @@ static int twa_check_srl(TW_Device_Extension *tw_dev, int *flashed)
608 } 608 }
609 609
610 /* Load rest of compatibility struct */ 610 /* Load rest of compatibility struct */
611 strncpy(tw_dev->tw_compat_info.driver_version, TW_DRIVER_VERSION, strlen(TW_DRIVER_VERSION)); 611 strlcpy(tw_dev->tw_compat_info.driver_version, TW_DRIVER_VERSION,
612 sizeof(tw_dev->tw_compat_info.driver_version));
612 tw_dev->tw_compat_info.driver_srl_high = TW_CURRENT_DRIVER_SRL; 613 tw_dev->tw_compat_info.driver_srl_high = TW_CURRENT_DRIVER_SRL;
613 tw_dev->tw_compat_info.driver_branch_high = TW_CURRENT_DRIVER_BRANCH; 614 tw_dev->tw_compat_info.driver_branch_high = TW_CURRENT_DRIVER_BRANCH;
614 tw_dev->tw_compat_info.driver_build_high = TW_CURRENT_DRIVER_BUILD; 615 tw_dev->tw_compat_info.driver_build_high = TW_CURRENT_DRIVER_BUILD;