From patchwork Tue Oct 10 20:54:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9997731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C057601AE for ; Tue, 10 Oct 2017 20:54:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F08128780 for ; Tue, 10 Oct 2017 20:54:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53E6528784; Tue, 10 Oct 2017 20:54:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECF128780 for ; Tue, 10 Oct 2017 20:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933174AbdJJUyr (ORCPT ); Tue, 10 Oct 2017 16:54:47 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:54828 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933367AbdJJUyc (ORCPT ); Tue, 10 Oct 2017 16:54:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1507668873; x=1539204873; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=4BsXKtfSmGooytA5qJooBEuooFfg6lc7yuBqMIW5rV0=; b=lABEELWotIR2PzHRW6xFE/Md8WEY0Lq0NrfUV92HRLMPS4yD/AJ/484c vE/FDtmZPnb+LZbInpOdKMnbvsVmlvTnL/BTyAvF8RzmogRdJRm+lkA7t H+g5tUn8UJiVa22YdvltaKRbqRasQ8buqm6uiIWFLfx9ap/qChp+JxjgO n8r7IfJmcnV7PWp0xW/LoBLR48TYEwiff6ZcwSpImcYJVUzjy3bqVkcrC pUMflpJdWjUEl3WxKIbk3UEeJ1iFU81RHLyD74hsVHrdgJ5OFfUTIkfXD MjiX0W9TYSP5/q/wLuc4tprAn/k6Wv2srrTmni1J4ETsNwQhu15Pw2L8O g==; X-IronPort-AV: E=Sophos;i="5.43,359,1503331200"; d="scan'208";a="57098099" Received: from sjappemgw11.hgst.com (HELO sjappemgw12.hgst.com) ([199.255.44.62]) by ob1.hgst.iphmx.com with ESMTP; 11 Oct 2017 04:54:33 +0800 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by sjappemgw12.hgst.com with ESMTP; 10 Oct 2017 13:54:31 -0700 From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" Cc: Christoph Hellwig , Bart Van Assche , stable@vger.kernel.org Subject: [PATCH 5/5] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics() Date: Wed, 11 Oct 2017 05:54:25 +0900 Message-Id: <20171010205425.7376-6-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010205425.7376-1-damien.lemoal@wdc.com> References: <20171010205425.7376-1-damien.lemoal@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The three values starting at byte 8 of the Zoned Block Device Characteristics VPD page B6h are 32 bits values, not 64bits. So use get_unaligned_be32() to retrieve the values and not get_unaligned_be64() Fixes: 89d947561077 ("sd: Implement support for ZBC devices") Cc: Signed-off-by: Damien Le Moal Reviewed-by: Bart Van Assche Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index bbad851c1789..27793b9f54c0 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -423,15 +423,15 @@ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp, if (sdkp->device->type != TYPE_ZBC) { /* Host-aware */ sdkp->urswrz = 1; - sdkp->zones_optimal_open = get_unaligned_be64(&buf[8]); - sdkp->zones_optimal_nonseq = get_unaligned_be64(&buf[12]); + sdkp->zones_optimal_open = get_unaligned_be32(&buf[8]); + sdkp->zones_optimal_nonseq = get_unaligned_be32(&buf[12]); sdkp->zones_max_open = 0; } else { /* Host-managed */ sdkp->urswrz = buf[4] & 1; sdkp->zones_optimal_open = 0; sdkp->zones_optimal_nonseq = 0; - sdkp->zones_max_open = get_unaligned_be64(&buf[16]); + sdkp->zones_max_open = get_unaligned_be32(&buf[16]); } return 0;