diff options
author | Sam Ravnborg | 2020-11-28 23:41:12 +0100 |
---|---|---|
committer | Sam Ravnborg | 2020-12-05 21:01:36 +0100 |
commit | 5a15468b724bbe385bb8531942a715731c241520 (patch) | |
tree | 373756d66612139f855108f0e585916af95f5980 /drivers/video | |
parent | ab2b29e64e05f2d92dc4a584de7818bc9a1eea4c (diff) |
video: fbdev: uvesafb: Fix string related warnings
Two W=1 string related warnings.
- Using strncpy to copy string without null-termination generates a
warning. Use memcpy to copy only the relevant chars
- Fix a potential bug with a very long string, subtract one from the
length to make room for the termination null.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Michal Januszewski <spock@gentoo.org>
Cc: linux-fbdev@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-27-sam@ravnborg.org
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/uvesafb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c index def14ac0ebe1..6c9cfab39313 100644 --- a/drivers/video/fbdev/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c @@ -423,7 +423,7 @@ static int uvesafb_vbe_getinfo(struct uvesafb_ktask *task, task->t.flags = TF_VBEIB; task->t.buf_len = sizeof(struct vbe_ib); task->buf = &par->vbe_ib; - strncpy(par->vbe_ib.vbe_signature, "VBE2", 4); + memcpy(par->vbe_ib.vbe_signature, "VBE2", 4); err = uvesafb_exec(task); if (err || (task->t.regs.eax & 0xffff) != 0x004f) { @@ -1871,7 +1871,7 @@ static ssize_t v86d_show(struct device_driver *dev, char *buf) static ssize_t v86d_store(struct device_driver *dev, const char *buf, size_t count) { - strncpy(v86d_path, buf, PATH_MAX); + strncpy(v86d_path, buf, PATH_MAX - 1); return count; } static DRIVER_ATTR_RW(v86d); |