Skip to contentSkip to conversation

target: iscsi: fix an error message in iscsi_check_key()

PATCH Applied Maurizio Lombardi 3 participants 3 messages Feb 14, 2023 – Mar 7, 2023 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target: iscsi: fix an error message in iscsi_check_key()

The first half of the error message is printed by pr_err(), the second half is printed by pr_debug().
The user will therefore see only the first part of the message and will miss some useful information.

---
 drivers/target/iscsi/iscsi_target_parameters.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/target/iscsi/iscsi_target_parameters.c +7 -5
index 2317fb077db0..557516c642c3 100644
@@ -1262,18 +1262,20 @@ static struct iscsi_param *iscsi_check_key(
 		return param;
 
 	if (!(param->phase & phase)) {
-		pr_err("Key \"%s\" may not be negotiated during ",
-				param->name);
+		char *phase_name;
+
 		switch (phase) {
 		case PHASE_SECURITY:
-			pr_debug("Security phase.\n");
+			phase_name = "Security";
 			break;
 		case PHASE_OPERATIONAL:
-			pr_debug("Operational phase.\n");
+			phase_name = "Operational";
 			break;
 		default:
-			pr_debug("Unknown phase.\n");
+			phase_name = "Unknown";
 		}
+		pr_err("Key \"%s\" may not be negotiated during %s phase.\n",
+				param->name, phase_name);
 		return NULL;
 	}
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Maurizio Lombardi

The first half of the error message is printed by pr_err(), the second half is printed by pr_debug().
The user will therefore see only the first part of the message and will miss some useful information.

---
 drivers/target/iscsi/iscsi_target_parameters.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/target/iscsi/iscsi_target_parameters.c +4 -4
index 2317fb077db0..557516c642c3 100644
@@ -1262,18 +1262,20 @@ static struct iscsi_param *iscsi_check_key(
 		return param;
 
 	if (!(param->phase & phase)) {
-		pr_err("Key \"%s\" may not be negotiated during ",
-				param->name);
+		char *phase_name;
+
 		switch (phase) {
 		case PHASE_SECURITY:
-			pr_debug("Security phase.\n");
+			phase_name = "Security";
 			break;
 		case PHASE_OPERATIONAL:
-			pr_debug("Operational phase.\n");
+			phase_name = "Operational";

drivers/target/iscsi/iscsi_target_parameters.c static struct iscsi_param *iscsi_check_key( · line 1281

Quoted 10 lines
drivers/target/iscsi/iscsi_target_parameters.c +3 -1
 			break;
 		default:
-			pr_debug("Unknown phase.\n");
+			phase_name = "Unknown";
 		}
+		pr_err("Key \"%s\" may not be negotiated during %s phase.\n",
+				param->name, phase_name);
 		return NULL;
 	}
 
#2 lore raw
In reply to Maurizio Lombardi
Quoted 6 lines · Maurizio Lombardi

The first half of the error message is printed by pr_err(), the second half is printed by pr_debug().
The user will therefore see only the first part of the message and will miss some useful information.

Applied to 6.3/scsi-fixes, thanks!

[1/1] target: iscsi: fix an error message in iscsi_check_key()

      https://git.kernel.org/mkp/scsi/c/6cc55c969b7c
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering