zdump/ngdump: Fix seek error on 'zgetdump -d'

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: f3bcd94524 ("zdump: Add zgetdump -d support for ECKD ldipl-dump")
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2024-09-12 20:43:37 +02:00
committed by Jan Höppner
parent 3989e1b741
commit 279070fa43

View File

@@ -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;