add missing calls to kfree
Subsystems (2)
cover add missing calls to kfree
The first patch is a style fix, the second add calls to kfree.
The reason for me thinking that they are necessary is that every other branches leading to an error return are jumping to the same destination.
--- drivers/staging/rts5208/ms.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
---
PATCH 1/2 staging: rts5208/ms.c: change the label name to respect the coding style
--- drivers/staging/rts5208/ms.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rts5208/ms.c +6 -6
@@ -4313,7 +4313,7 @@ int mg_get_local_EKB(struct scsi_cmnd *sif (retval !=STATUS_SUCCESS ) {set_sense_type (chip, lun,SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN );rtsx_trace (chip); - goto GetEKBFinish; + goto free_buffer; } retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
@@ -4322,7 +4322,7 @@ int mg_get_local_EKB(struct scsi_cmnd *sset_sense_type (chip, lun,SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN );rtsx_clear_ms_error (chip);rtsx_trace (chip); - goto GetEKBFinish; + goto free_buffer; }if (check_ms_err (chip)) {set_sense_type (chip, lun,SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN );
@@ -4334,7 +4334,7 @@ int mg_get_local_EKB(struct scsi_cmnd *s bufflen =min_t (int,1052 ,scsi_bufflen (srb));rtsx_stor_set_xfer_buf (buf, bufflen, srb); -GetEKBFinish: +free_buffer:kfree (buf);return retval; }
@@ -4566,7 +4566,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, stif (retval !=STATUS_SUCCESS ) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR );rtsx_trace (chip); - goto GetICVFinish; + goto free_buffer; } retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
@@ -4575,7 +4575,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, stset_sense_type (chip, lun,SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR );rtsx_clear_ms_error (chip);rtsx_trace (chip); - goto GetICVFinish; + goto free_buffer; }if (check_ms_err (chip)) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR );
@@ -4587,7 +4587,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, st bufflen =min_t (int,1028 ,scsi_bufflen (srb));rtsx_stor_set_xfer_buf (buf, bufflen, srb); -GetICVFinish: +free_buffer:kfree (buf);return retval; }
PATCH 2/2 staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV
In reply to Quentin Lambertmg_get_local_EKB and mg_get_ICV used to return with an error code before releasing all resources. This patch add a jump to the appropriate label ensuring that the resources are properly released before returning.
This issue was found with Hector.
--- drivers/staging/rts5208/ms.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rts5208/ms.c +4 -2
@@ -4328,7 +4328,8 @@ int mg_get_local_EKB(struct scsi_cmnd *sset_sense_type (chip, lun,SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN );rtsx_clear_ms_error (chip);rtsx_trace (chip); -return STATUS_FAIL ; + retval =STATUS_FAIL ; + goto free_buffer; } bufflen =min_t (int,1052 ,scsi_bufflen (srb));
@@ -4581,7 +4582,8 @@ int mg_get_ICV(struct scsi_cmnd *srb, stset_sense_type (chip, lun,SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR );rtsx_clear_ms_error (chip);rtsx_trace (chip); -return STATUS_FAIL ; + retval =STATUS_FAIL ; + goto free_buffer; } bufflen =min_t (int,1028 ,scsi_bufflen (srb));
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style
In reply to Quentin LambertQuoted 4 lines · Quentin Lambert
Signed-off-by Quentin Lambert <[email protected]>--- drivers/staging/rts5208/ms.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
I can't take patches without any changelog comments, sorry.
greg k-h