mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dasd_fba: Display '00000000' for zero page when dumping sense
@ 2019-11-18 11:12 Hannes Reinecke
  2019-11-21 12:36 ` Jan Höppner
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2019-11-18 11:12 UTC (permalink / raw)
  To: Jan Hoeppner
  Cc: Stefan Haberland, linux-s390, Linux Kernel Mailinglist,
	Hannes Reinecke, Hannes Reinecke, Sebastian Parschauer

When a discard I/O fails, dasd_fba_dump_sense() will crash as it
tries to print out the CCW, and failing to take into account that
for discard I/O we have only one data pointer, not one per sg.
As the data pointer will always point to the zero page this patch
replaces the data pointer output with '00000000' to avoid the crash.

Signed-off-by: Hannes Reinecke <hare@suse.com>
[sparschauer: replaced "ccw" with "act", "snprintf" with "sprintf"]
[sparschauer v2: added missing curly braces to for loops]
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
 drivers/s390/block/dasd_fba.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index cbb770824226..4b867bd6b164 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -717,10 +717,15 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 			       " CCW %p: %08X %08X DAT:",
 			       act, ((int *) act)[0], ((int *) act)[1]);
 		for (count = 0; count < 32 && count < act->count;
-		     count += sizeof(int))
+		     count += sizeof(int)) {
+			if (act->flags & CCW_FLAG_SLI) {
+				len += sprintf(page + len, " 00000000");
+				break;
+			}
 			len += sprintf(page + len, " %08X",
 				       ((int *) (addr_t) act->cda)
 				       [(count>>2)]);
+		}
 		len += sprintf(page + len, "\n");
 		act++;
 	}
@@ -739,10 +744,15 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 			       " CCW %p: %08X %08X DAT:",
 			       act, ((int *) act)[0], ((int *) act)[1]);
 		for (count = 0; count < 32 && count < act->count;
-		     count += sizeof(int))
+		     count += sizeof(int)) {
+			if (act->flags & CCW_FLAG_SLI) {
+				len += sprintf(page + len, " 00000000");
+				break;
+			}
 			len += sprintf(page + len, " %08X",
 				       ((int *) (addr_t) act->cda)
 				       [(count>>2)]);
+		}
 		len += sprintf(page + len, "\n");
 		act++;
 	}
@@ -757,10 +767,15 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 			       " CCW %p: %08X %08X DAT:",
 			       act, ((int *) act)[0], ((int *) act)[1]);
 		for (count = 0; count < 32 && count < act->count;
-		     count += sizeof(int))
+		     count += sizeof(int)) {
+			if (act->flags & CCW_FLAG_SLI) {
+				len += sprintf(page + len, " 00000000");
+				break;
+			}
 			len += sprintf(page + len, " %08X",
 				       ((int *) (addr_t) act->cda)
 				       [(count>>2)]);
+		}
 		len += sprintf(page + len, "\n");
 		act++;
 	}
-- 
2.16.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-21 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 11:12 [PATCH] dasd_fba: Display '00000000' for zero page when dumping sense Hannes Reinecke
2019-11-21 12:36 ` Jan Höppner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®