From 279070fa43b1a3e25e0e98e6573898fb24966d29 Mon Sep 17 00:00:00 2001 From: Mikhail Zaslonko Date: Thu, 12 Sep 2024 20:43:37 +0200 Subject: [PATCH] zdump/ngdump: Fix seek error on 'zgetdump -d' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When checking CDL formatted DASD for installed dump-tool (zgetdump -d), we might stumble upon an 'empty' boot record pointer in the volume label filled with bytes of 0x40 (EBCDIC spaces). This leads to the following seek error reported: # zgetdump -d /dev/dasdb zgetdump: Could not seek "/dev/dasdb" (Invalid argument) Check for empty boot record and return proper error code by ngdump_get_eckd_part_num() in order to end up with a regular "No dump tool found" message. Fixes: f3bcd94524ba ("zdump: Add zgetdump -d support for ECKD ldipl-dump") Signed-off-by: Mikhail Zaslonko Reviewed-by: Alexander Egorenkov Signed-off-by: Jan Höppner --- zdump/ngdump.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zdump/ngdump.c b/zdump/ngdump.c index 3a917738..b94973af 100644 --- a/zdump/ngdump.c +++ b/zdump/ngdump.c @@ -435,6 +435,13 @@ static int ngdump_get_eckd_part_num(struct zg_fh *zg_fh) if (!is_vol1(vl.vollbl)) return -1; /* Read Master Boot Record and check its magic */ + if (vl.br.cc == 0x4040 && vl.br.hh == 0x4040 && + vl.br.b == 0x40) { + util_log_print(UTIL_LOG_TRACE, + "%s: No boot record pointer found in volume label\n", + __func__); + return -1; + } blk = cchhb2blk(&vl.br, &geo); if (blk == 0) return -1;