Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2697327ybc; Mon, 18 Nov 2019 03:17:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzbtUuSd7sZhq4KxD0gMO+SVKI1jkz0W/4GiuwEwZffqCEqfl/892rfkswNHwYQuZqSMPZM X-Received: by 2002:a05:6000:12d1:: with SMTP id l17mr28783112wrx.261.1574075827974; Mon, 18 Nov 2019 03:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574075827; cv=none; d=google.com; s=arc-20160816; b=BuNtfVO6zfO+HQ4rqJQ7nCMTzhmYLhkT3JTRd4hBJTPybM6mSBgZAAsUhSq8OLqkPv lZlG0ZJRWgkTJINWvTxjLvWxVhau7C4WZIHyzHW9qm3wOJ7tuI8455cUo/PP42nniF1l gR58Lr1fvBYFRnsK7SAoX19Ni/228jA55CmzZxRy6L38mb0SuMXZljsvfpa9AAiRc3p2 MRNzWioLGY5T4tSYh9iFr07h0Vhf1ynoVfts5Xq1x0HNDEy8knPbM51sG7cSrXiF5B0C kwPf7ja1nSLHWl3Puv3vGhl8BQoNp+nZQu4z3fXrjKui9Fr+zUN9L8uNvytUhi0EegcN hh7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=GnCGLmxuS9Vw4ddsqp2pxUahKZEeeYL8w6kYE2Ulxm4=; b=TIPBP7GyhNoEFuDxFsSuyPdZutbl9l7wZ4yJeGI2jO7cWb8D5Vz/7DO/erkpITG41x kgpxuz/wsfepc4cyhFc6zLoVN7pDfRsxhoOSpGnuGlbYgpUIvzuTnLu45y48fm+HBfNh qKHr8aJtY6oI56BQrUduQ/OM0QYhyURmWfdaU8W7KUYuJ8dPvKtPkjW7EuSPuHU+h1m0 0hNWXdrk1SePyX5O5pt0c/xOYWTrjIWXnSx/fN42tXYfqEN8CeqMJSJDt8lzGtK+r4EM IfrvvZHKFkCZRb7uXuFIqSfOQqJROzLlyC9+SFYNtUPCFew45w1El4PRnu+7a04Ax+Wc 1YCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si12750261edj.417.2019.11.18.03.16.44; Mon, 18 Nov 2019 03:17:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbfKRLMq (ORCPT + 99 others); Mon, 18 Nov 2019 06:12:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:35954 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726460AbfKRLMp (ORCPT ); Mon, 18 Nov 2019 06:12:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 52F8CB42B; Mon, 18 Nov 2019 11:12:43 +0000 (UTC) From: Hannes Reinecke To: Jan Hoeppner Cc: Stefan Haberland , linux-s390@vger.kernel.org, Linux Kernel Mailinglist , Hannes Reinecke , Hannes Reinecke , Sebastian Parschauer Subject: [PATCH] dasd_fba: Display '00000000' for zero page when dumping sense Date: Mon, 18 Nov 2019 12:12:26 +0100 Message-Id: <20191118111226.56666-1-hare@suse.de> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 [sparschauer: replaced "ccw" with "act", "snprintf" with "sprintf"] [sparschauer v2: added missing curly braces to for loops] Signed-off-by: Sebastian Parschauer --- 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