* [PATCH 0/2] add missing calls to kfree
@ 2016-08-12 12:58 Quentin Lambert
2016-08-12 12:58 ` [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style Quentin Lambert
2016-08-12 12:58 ` [PATCH 2/2] staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV Quentin Lambert
0 siblings, 2 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-08-12 12:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, linux-kernel; +Cc: kernel-janitors
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(-)
---
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style
2016-08-12 12:58 [PATCH 0/2] add missing calls to kfree Quentin Lambert
@ 2016-08-12 12:58 ` Quentin Lambert
2016-08-12 14:06 ` Greg Kroah-Hartman
2016-08-12 12:58 ` [PATCH 2/2] staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV Quentin Lambert
1 sibling, 1 reply; 4+ messages in thread
From: Quentin Lambert @ 2016-08-12 12:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, linux-kernel; +Cc: kernel-janitors, Quentin Lambert
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/staging/rts5208/ms.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -4313,7 +4313,7 @@ int mg_get_local_EKB(struct scsi_cmnd *s
if (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 *s
set_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, st
if (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, st
set_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;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV
2016-08-12 12:58 [PATCH 0/2] add missing calls to kfree Quentin Lambert
2016-08-12 12:58 ` [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style Quentin Lambert
@ 2016-08-12 12:58 ` Quentin Lambert
1 sibling, 0 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-08-12 12:58 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, linux-kernel; +Cc: kernel-janitors, Quentin Lambert
mg_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.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/staging/rts5208/ms.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -4328,7 +4328,8 @@ int mg_get_local_EKB(struct scsi_cmnd *s
set_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, st
set_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));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style
2016-08-12 12:58 ` [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style Quentin Lambert
@ 2016-08-12 14:06 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2016-08-12 14:06 UTC (permalink / raw)
To: Quentin Lambert; +Cc: devel, linux-kernel, kernel-janitors
On Fri, Aug 12, 2016 at 02:58:34PM +0200, Quentin Lambert wrote:
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-12 14:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-12 12:58 [PATCH 0/2] add missing calls to kfree Quentin Lambert
2016-08-12 12:58 ` [PATCH 1/2] staging: rts5208/ms.c: change the label name to respect the coding style Quentin Lambert
2016-08-12 14:06 ` Greg Kroah-Hartman
2016-08-12 12:58 ` [PATCH 2/2] staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV Quentin Lambert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox