• Guenter Roeck's avatar
    staging: speakup: Replace strncpy with memcpy · df62280b
    Guenter Roeck authored
    commit fd29edc7232bc19f969e8f463138afc5472b3d5f upstream.
    
    gcc 8.1.0 generates the following warnings.
    
    drivers/staging/speakup/kobjects.c: In function 'punc_store':
    drivers/staging/speakup/kobjects.c:522:2: warning:
    	'strncpy' output truncated before terminating nul
    	copying as many bytes from a string as its length
    drivers/staging/speakup/kobjects.c:504:6: note: length computed here
    
    drivers/staging/speakup/kobjects.c: In function 'synth_store':
    drivers/staging/speakup/kobjects.c:391:2: warning:
    	'strncpy' output truncated before terminating nul
    	copying as many bytes from a string as its length
    drivers/staging/speakup/kobjects.c:388:8: note: length computed here
    
    Using strncpy() is indeed less than perfect since the length of data to
    be copied has already been determined with strlen(). Replace strncpy()
    with memcpy() to address the warning and optimize the code a little.
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    df62280b
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...