]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
scsi: ibmvscsis: Fix a stringop-overflow warning
authorLaura Abbott <labbott@redhat.com>
Tue, 11 Sep 2018 19:22:25 +0000 (12:22 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:54:20 +0000 (19:54 -0600)
commit091424e34ab6257ee9cf0e7f313776d323438fb2
treef52a8656928b813f4b0092efe4b597abd3bfc3f0
parentd3453a267abaa5fe2c8bb617a7f28dd860ef4e40
scsi: ibmvscsis: Fix a stringop-overflow warning

BugLink: https://bugs.launchpad.net/bugs/1836654
[ Upstream commit d792d4c4fc866ae224b0b0ca2aabd87d23b4d6cc ]

There's currently a warning about string overflow with strncat:

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_probe':
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3479:2: error: 'strncat' specified
bound 64 equals destination size [-Werror=stringop-overflow=]
  strncat(vscsi->eye, vdev->name, MAX_EYE);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Switch to a single snprintf instead of a strcpy + strcat to handle this
cleanly.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c