From a3eb530bb4b93949287f19a2b6fb418901f1f699 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Thu, 2 Jun 2022 22:27:57 +0000 Subject: more sg_get_elem_status work git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@954 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- src/sg_get_elem_status.c | 10 ++++++---- src/sg_inq_data.c | 6 ++++-- src/sg_opcodes.c | 8 +++++++- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sg_get_elem_status.c b/src/sg_get_elem_status.c index bafb7028..47e18a99 100644 --- a/src/sg_get_elem_status.c +++ b/src/sg_get_elem_status.c @@ -37,7 +37,7 @@ * given SCSI device. */ -static const char * version_str = "1.09 20220524"; /* sbc5r01 */ +static const char * version_str = "1.10 20220527"; /* sbc5r01 */ #define MY_NAME "sg_get_elem_status" @@ -132,9 +132,11 @@ usage() " --verbose|-v increase verbosity\n" " --version|-V print version string and exit\n\n" "Performs a SCSI GET PHYSICAL ELEMENT STATUS command (see SBC-3 " - "or SBC-4).\nIf --inhex=FN is given then contents of FN is " - "assumed to be a response\nto this command in ASCII hex. " - "Returned element descriptors should be\nin ascending " + "or SBC-4).\nStorage elements are a sub-set of physical " + "elements. Currently the only\ntype of physical element is a " + "storage element. If --inhex=FN is given then\ncontents of FN " + "is assumed to be a response to this command in ASCII hex.\n" + "Returned element descriptors should be in ascending " "identifier order.\n" ); } diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c index 1602def5..9458d6b8 100644 --- a/src/sg_inq_data.c +++ b/src/sg_inq_data.c @@ -1,6 +1,6 @@ /* * A utility program originally written for the Linux OS SCSI subsystem. - * Copyright (C) 2000-2019 D. Gilbert + * Copyright (C) 2000-2022 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -9,7 +9,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later * * This is an auxiliary file holding data tables for the sg_inq utility. - * It is mainly based on the SCSI SPC-5 document at https://www.t10.org . + * It is mainly based on the SCSI SPC-6 document at https://www.t10.org . */ #include @@ -228,6 +228,8 @@ struct sg_lib_simple_value_name_t sg_version_descriptor_arr[] = { {0x584, "SES-3 T10/BSR INCITS 518 revision 14"}, {0x5a0, "SSC-5 (no version claimed)"}, {0x5c0, "SPC-5 (no version claimed)"}, +/* SPC-5 is now a standard [ANSI INCITS 502-2020] but no version code */ +/* SPC-6 is now up to draft 06 but still no version code */ {0x5e0, "SFSC (no version claimed)"}, {0x5e3, "SFSC BSR INCITS 501 revision 01"}, {0x5e5, "SFSC BSR INCITS 501 revision 02"}, diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c index aba72afe..9d6f6c06 100644 --- a/src/sg_opcodes.c +++ b/src/sg_opcodes.c @@ -33,7 +33,7 @@ #include "sg_pt.h" -static const char * version_str = "0.81 20220506"; /* spc6r06 */ +static const char * version_str = "0.82 20220528"; /* spc6r06 */ #define MY_NAME "sg_opcodes" @@ -1346,6 +1346,12 @@ open_rw: /* if not already open */ act_len = (rq_len < act_len) ? rq_len : act_len; start_response: + if (act_len < 4) { + pr2serr("Actual length of response [%d] is too small\n", act_len); + res = SG_LIB_CAT_OTHER; + no_final_msg = true; + goto err_out; + } if (op->do_taskman) { if (op->do_raw) { dStrRaw((const char *)rsoc_buff, act_len); -- cgit v1.2.3