From owner-freebsd-hackers Tue Feb 14 23:03:08 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id XAA06809 for hackers-outgoing; Tue, 14 Feb 1995 23:03:08 -0800 Received: from zibbi.mikom.csir.co.za (zibbi.mikom.csir.co.za [146.64.24.58]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id XAA06785; Tue, 14 Feb 1995 23:02:48 -0800 Received: (from jhay@localhost) by zibbi.mikom.csir.co.za (8.6.9/8.6.6) id IAA08039; Wed, 15 Feb 1995 08:44:38 +0200 From: John Hay Message-Id: <199502150644.IAA08039@zibbi.mikom.csir.co.za> Subject: BUG + fix in scsi_base.c To: bugs@FreeBSD.org, hackers@FreeBSD.org Date: Wed, 15 Feb 1995 08:44:38 +0200 (SAT) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 1398 Sender: hackers-owner@FreeBSD.org Precedence: bulk >From a week or two ago I got kernel panics as soon as I tried to access my tape drive. I traced it to sys/scsi/scsi_base.c where some code were added to print the return values of the sense command. My tape drive returned a extended flags value of 0x20, so the key that is the lower 4 bits, is 0. The code uses "key-1" to index into a table and then the kernel go to never- never land. Here is a fix for this. Will somebody please apply it? -- John Hay -- jhay@mikom.csir.co.za *** sys/scsi/scsi_base.c.org Wed Feb 1 08:17:29 1995 --- sys/scsi/scsi_base.c Wed Feb 15 08:29:19 1995 *************** *** 661,667 **** */ static char *sense_key_text[] = { ! "RECOVERED ERROR", "NOT READY", "MEDIUM ERROR", "HARDWARE FAILURE", "ILLEGAL REQUEST", "UNIT ATTENTION", "DATA PROTECT", --- 661,667 ---- */ static char *sense_key_text[] = { ! "NO SENSE", "RECOVERED ERROR", "NOT READY", "MEDIUM ERROR", "HARDWARE FAILURE", "ILLEGAL REQUEST", "UNIT ATTENTION", "DATA PROTECT", *************** *** 686,692 **** case 0x70: ! printf("%s", sense_key_text[key - 1]); info = ntohl(*((long *) ext->info)); if (sense->error_code & SSD_ERRCODE_VALID) { --- 686,692 ---- case 0x70: ! printf("%s", sense_key_text[key]); info = ntohl(*((long *) ext->info)); if (sense->error_code & SSD_ERRCODE_VALID) {