scsi: pm8001: Fix error code in non_fatal_log_show()
Subsystems (3)
PATCH 1/1 scsi: pm8001: Fix error code in non_fatal_log_show()
The non_fatal_log_show() function is supposed to return negative error codes on failure. But because the error codes are saved in a u32 and then cast to signed long, they end up being high positive values instead of negative. Remove the intermediary u32 variable to fix this bug.
--- drivers/scsi/pm8001/pm8001_ctl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_ctl.c +1 -4
@@ -588,10 +588,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);static ssize_t non_fatal_log_show (struct device *cdev,struct device_attribute *attr,char *buf) { -u32 count; - - count =pm80xx_get_non_fatal_dump (cdev, attr, buf); -return count; +return pm80xx_get_non_fatal_dump (cdev, attr, buf); }static DEVICE_ATTR_RO (non_fatal_log);
Signature · 1 line
2.53.0
Quoted 9 lines · Dan Carpenter
The
non_fatal_log_show()function is supposed to return negative error codes on failure. But because the error codes are saved in a u32 and then cast to signed long, they end up being high positive values instead of negative. Remove the intermediary u32 variable to fix this bug.Fixes dba2cc03b9db ("scsi: pm80xx: sysfs attribute for non fatal dump")Signed-off-by Dan Carpenter <[email protected]>
Quoted 23 lines
--- drivers/scsi/pm8001/pm8001_ctl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/scsi/pm8001/pm8001_ctl.c +1
-5@@ -588,10 +588,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);static ssize_t non_fatal_log_show (struct device *cdev,struct device_attribute *attr,char *buf) { -u32 count; - - count =pm80xx_get_non_fatal_dump (cdev, attr, buf); -return count; +return pm80xx_get_non_fatal_dump (cdev, attr, buf); }static DEVICE_ATTR_RO (non_fatal_log); --2.53.0
Martin K. Petersen
AppliedDan,
Quoted 5 lines
The
non_fatal_log_show()function is supposed to return negative error codes on failure. But because the error codes are saved in a u32 and then cast to signed long, they end up being high positive values instead of negative. Remove the intermediary u32 variable to fix this bug.
Applied to 7.2/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 8 lines · Dan Carpenter
The
non_fatal_log_show()function is supposed to return negative error codes on failure. But because the error codes are saved in a u32 and then cast to signed long, they end up being high positive values instead of negative. Remove the intermediary u32 variable to fix this bug.[...]
Applied to 7.2/scsi-queue, thanks!
[1/1] scsi: pm8001: Fix error code in non_fatal_log_show()
https://git.kernel.org/mkp/scsi/c/1b6f03b7ae9e
Signature · 1 line
Martin K. Petersen