Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1381192pxb; Fri, 22 Jan 2021 14:26:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuKIBLmjjA+yuSPS4Np70N9JHBF/BrcBxrX+Spg9iuOHh9pHlmvQomiSKGazZ8L8/Adh3S X-Received: by 2002:a17:906:3685:: with SMTP id a5mr247013ejc.544.1611354360843; Fri, 22 Jan 2021 14:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611354360; cv=none; d=google.com; s=arc-20160816; b=d5el5w+tWjEuxRhWQv+7paPyLZ+03g/bb6/HHcMVSxueHjd8f/Ftia5Gy0ADki8oEB miBiBw6jmEThqwOp+z4v8qBTv3TOlOCCbLF766t6lxKa2mNp272G/lOxrmWZxU9CYERJ CUBfTs4hnV5CVAbPi3gUccSJ2OeXySBz7PZxxjopY229FS0xKo61nwNdn7hGcWo+InNf KRD5Yas90ug3HId8yE07UL0Su2MlCdWtW2hbvxVCGEpo9RP0Txldqn334zJth1ooIKPp vrPKQIvBIZYRhVelyhctqIMFBE/9zwjSLP1n0ZlxUAlgo8BWsOAGRobr9H5pTUShy7Bg zxYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=iJNkgfAkLn3G0Jr90sYu9NowBX2HZx2PfUHAjq5hb7c=; b=aMyIqrjC7fed2Pqe8UNj7u/qoHYokm24n5KrJJzM01L9ErQ69EaO8J3PW6C27W30Ro u/YrmLZbFZb1uMs0cEyXBCgpidE7tZJud1bR4eAmADRI1XAT8fUOgCn2BTjhQ4ZfTLK2 IEJfomdfnUTCZ15u5NrmgEHL3PHD/9hb/jC3Yc8+QBf1LJQv1J0kSVM5eSGHTgNehu3Y e80Zy6xSL3DBGlxnaXINrquD6CwCzMNKvVi46BqadOw5DqFRTNydK5uqwPw+hI/O6eza JY2Mj4cmtBhjX3EZTLrr8Tu5v6SBuiiyxcczxXCH5jkdfy3T1VhYvhM6TgJ90RuqI+mZ G9ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Wx/+JpRV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh15si3435508ejb.612.2021.01.22.14.25.36; Fri, 22 Jan 2021 14:26:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Wx/+JpRV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbhAVWYk (ORCPT + 99 others); Fri, 22 Jan 2021 17:24:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56551 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730639AbhAVTyb (ORCPT ); Fri, 22 Jan 2021 14:54:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611345184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iJNkgfAkLn3G0Jr90sYu9NowBX2HZx2PfUHAjq5hb7c=; b=Wx/+JpRVmj6/IHn9xf5MMH0C2zyFWPSsjFi0cN68n/loFEx6LatZf3pup9G4qp1qfSOGks 7YlulkpoxMBER7xFoZ/BnRa+x80ibVwrFRye43l7hmaBr9PedNUYAearWh7JrZn6Z8z8i0 eJOT1i06VL9rOgejSHMwPZ3+iD0cMPQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-3kFJGJg0MOCp8XUUrlrJ8g-1; Fri, 22 Jan 2021 14:53:00 -0500 X-MC-Unique: 3kFJGJg0MOCp8XUUrlrJ8g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D016E10054FF; Fri, 22 Jan 2021 19:52:58 +0000 (UTC) Received: from ovpn-113-224.phx2.redhat.com (ovpn-113-224.phx2.redhat.com [10.3.113.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id A735B71D4D; Fri, 22 Jan 2021 19:52:57 +0000 (UTC) Message-ID: Subject: Re: [PATCH] scsi_logging: print cdb into new line after opcode From: "Ewan D. Milne" To: Martin Kepplinger , jejb@linux.ibm.com, martin.petersen@oracle.com Cc: dgilbert@interlog.com, bvanassche@acm.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 22 Jan 2021 14:52:56 -0500 In-Reply-To: <20210122083918.901-1-martin.kepplinger@puri.sm> References: <20210122083918.901-1-martin.kepplinger@puri.sm> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-01-22 at 09:39 +0100, Martin Kepplinger wrote: > The current log message results in a line like the following where > the first byte is duplicated, giving a wrong impression: > > sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 00 60 40 00 00 01 > 00 > > Print the cdb into a new line in any case, not only when cmd_len is > greater than 16. The above example error will then read: > > sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 > 28 00 01 c0 09 00 00 00 08 00 > > Signed-off-by: Martin Kepplinger > --- > drivers/scsi/scsi_logging.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/scsi_logging.c > b/drivers/scsi/scsi_logging.c > index 8ea44c6595ef..0081d3936f83 100644 > --- a/drivers/scsi/scsi_logging.c > +++ b/drivers/scsi/scsi_logging.c > @@ -200,10 +200,11 @@ void scsi_print_command(struct scsi_cmnd *cmd) > if (off >= logbuf_len) > goto out_printk; > > + /* Print opcode in one line and use separate lines for CDB */ > + off += scnprintf(logbuf + off, logbuf_len - off, "\n"); > + > /* print out all bytes in cdb */ > if (cmd->cmd_len > 16) { > - /* Print opcode in one line and use separate lines for > CDB */ > - off += scnprintf(logbuf + off, logbuf_len - off, "\n"); > dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", > logbuf); > for (k = 0; k < cmd->cmd_len; k += 16) { > size_t linelen = min(cmd->cmd_len - k, 16); > @@ -224,7 +225,6 @@ void scsi_print_command(struct scsi_cmnd *cmd) > goto out; > } > if (!WARN_ON(off > logbuf_len - 49)) { > - off += scnprintf(logbuf + off, logbuf_len - off, " "); > hex_dump_to_buffer(cmd->cmnd, cmd->cmd_len, 16, 1, > logbuf + off, logbuf_len - off, > false); I'd rather we not change this. -Ewan