drivers/video: Fix -Wstringop-truncation in hdmi.c
Trying to copy into the string fields with strncpy() gives a warning from gcc. Both fields are part of a packed HDMI header and do not require a terminating \0 character. ../drivers/video/hdmi.c: In function 'hdmi_spd_infoframe_init': ../drivers/video/hdmi.c:230:2: warning: 'strncpy' specified bound 8 equals destination size [-Wstringop-truncation] 230 | strncpy(frame->vendor, vendor, sizeof(frame->vendor)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/video/hdmi.c:231:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation] 231 | strncpy(frame->product, product, sizeof(frame->product)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Just use memcpy() instead. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201021121241.17623-1-tzimmermann@suse.de
Showing
Please register or sign in to comment