Skip to content

Commit

Permalink
staging: lustre: Cleaning up unnecessary use of memset in conjunction…
Browse files Browse the repository at this point in the history
… with strncpy

Using memset before strncpy just to ensure a trailing null
character is an unnecessary double writing of a string

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Rickard Strandqvist authored and Greg Kroah-Hartman committed Sep 14, 2014
1 parent eb96712 commit 3f2882d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/libcfs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ int libcfs_debug_init(unsigned long bufsize)
}

if (libcfs_debug_file_path != NULL) {
memset(libcfs_debug_file_path_arr, 0, PATH_MAX);
strncpy(libcfs_debug_file_path_arr,
libcfs_debug_file_path, PATH_MAX-1);
libcfs_debug_file_path_arr[PATH_MAX - 1] = '\0';
}

/* If libcfs_debug_mb is set to an invalid value or uninitialized
Expand Down

0 comments on commit 3f2882d

Please sign in to comment.