From 015fe41e9887851827175dac1b8bfb6dacaff964 Mon Sep 17 00:00:00 2001 From: Himanshu Madhani Date: Thu, 1 Aug 2019 15:54:48 -0400 Subject: [PATCH 028/124] [scsi] scsi: qla2xxx: check for kstrtol() failure Message-id: <20190801155618.12650-29-hmadhani@redhat.com> Patchwork-id: 267806 O-Subject: [RHEL 7.8 e-stor PATCH 028/118] scsi: qla2xxx: check for kstrtol() failure Bugzilla: 1729270 RH-Acked-by: Jarod Wilson RH-Acked-by: Tony Camuso From: Dan Carpenter Bugzilla 1729270 The error handling was unintentionally left out so it introduces a Smatch static checker warning: drivers/scsi/qla2xxx/qla_attr.c:1655 qla2x00_port_speed_store() error: uninitialized symbol 'type'. Fixes: a7b9ca7fc87a ("scsi: qla2xxx: Add support for setting port speed") Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen (cherry picked from commit b8870ec63676aba1d823f0b36c5f7e9929e57d23) Signed-off-by: Himanshu Madhani Signed-off-by: Jan Stancek --- drivers/scsi/qla2xxx/qla_attr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 2e168fb19531..bc60835e7a3f 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1653,6 +1653,8 @@ qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr, } rval = kstrtol(buf, 10, &type); + if (rval) + return rval; speed = type; if (type == 40 || type == 80 || type == 160 || type == 320) { -- 2.13.6