Skip to contentSkip to conversation

libata: fixup oops in ata_eh_link_report()

PATCH In review Hannes Reinecke 2 participants 2 messages Jan 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libata: fixup oops in ata_eh_link_report()

We should only try to evaluate the cdb if this is an ATAPI device, for any other device the 'cdb' field and the cdb_len has no meaning.

---
 drivers/ata/libata-eh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +3 -2
index 9179f11..665fd2b 100644
@@ -2481,8 +2481,6 @@ static void ata_eh_link_report(struct ata_link *link)
 	for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
 		struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
 		struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf;
-		const u8 *cdb = qc->cdb;
-		size_t cdb_len = qc->dev->cdb_len;
 		char data_buf[20] = "";
 		char cdb_buf[70] = "";
 
@@ -2510,6 +2508,9 @@ static void ata_eh_link_report(struct ata_link *link)
 		}
 
 		if (ata_is_atapi(qc->tf.protocol)) {
+			const u8 *cdb = qc->cdb;
+			size_t cdb_len = qc->dev->cdb_len;
+
 			if (qc->scsicmd) {
 				cdb = qc->scsicmd->cmnd;
 				cdb_len = qc->scsicmd->cmd_len;
Signature · 1 line
1.8.5.2
#1 lore raw

Hello.

Quoted 5 lines · Hannes Reinecke

We should only try to evaluate the cdb if this is an ATAPI device, for any other device the 'cdb' field and the cdb_len has no meaning.

Fixes cbba5b0ee4c6c2fc8b78a21d0900099d480cf2e9

According to Documentation/SubmittingPatches, 12 digits is enough and,
more importantly, that commit's summary line needs to be specified enclosed in parens and double quotes.

Quoted 4 lines

MBR, Sergei