From patchwork Tue Jul 3 06:23:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 10503135 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 76DD1601D3 for ; Tue, 3 Jul 2018 06:24:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6636228A15 for ; Tue, 3 Jul 2018 06:24:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A53628A37; Tue, 3 Jul 2018 06:24:28 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 4CF3E28A15 for ; Tue, 3 Jul 2018 06:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933064AbeGCGY0 (ORCPT ); Tue, 3 Jul 2018 02:24:26 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:14808 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932950AbeGCGYN (ORCPT ); Tue, 3 Jul 2018 02:24:13 -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=1530599053; x=1562135053; h=from:to:cc:subject:date:message-id; bh=1yort01JfmYEdBD4JRmXmVIB2pgqkSaMsk33zCZ1qhA=; b=DpRUnJZGUJ+7ve2Tk96JXf9Qm3drMYpGPoKV3XmLDfheu13T+l1zGH15 hKYmOALlVImuY4NIuhBDpOiYQaQE5/OW61qzZ/4l9FzNZNfCPB1DyIbAd N3MC6e6GsWrrM9bLV0Cfuw/Noj/hAyCPBUQ08K7nIQA227KVDjIGkYdj3 Cmg5t/ct4LVRKuH8g2N78XBUFFtnHUTvWrvvtMRJNJ7gFA+LKX9FwSlGl dpUC99aO/yoT+LZh6+DPxlAswrgXSYGS8cA75hP1T68ICTS5EXyDLwEoQ SIsQ5dGAyN8EFti1aBjVFSn2Gh6WIOKmVH8VdVA1IpFDaG+xZu4Eq1WiV g==; X-IronPort-AV: E=Sophos;i="5.51,302,1526313600"; d="scan'208";a="83578076" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2018 14:24:12 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2018 23:13:17 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Jul 2018 23:24:12 -0700 From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" Cc: Bart Van Assche , Bart Van Assche , stable@kernel.org Subject: [PATCH] scsi: sd_zbc: Fix variable type and bogus comment Date: Tue, 3 Jul 2018 15:23:58 +0900 Message-Id: <20180703062358.7980-1-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 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 Fix the description of sd_zbc_check_zone_size() to correctly explain that the returned value is a number of device blocks, not bytes. Additionally, the 32 bits "ret" variable used in this function may truncate the 64 bits zone_blocks variable value upon return. To fix this, change "ret" type to s64. Fixes: ccce20fc79 ("sd_zbc: Avoid that resetting a zone fails sporadically") Signed-off-by: Damien Le Moal Cc: Bart Van Assche Cc: stable@kernel.org Reviewed-by: Hannes Reinecke Reviewed-by: Bart Van Assche --- drivers/scsi/sd_zbc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index a14fef11776e..2bf3bf73886e 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -391,7 +391,8 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf) * Check that all zones of the device are equal. The last zone can however * be smaller. The zone size must also be a power of two number of LBAs. * - * Returns the zone size in bytes upon success or an error code upon failure. + * Returns the zone size in number of blocks upon success or an error code + * upon failure. */ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) { @@ -401,7 +402,7 @@ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) unsigned char *rec; unsigned int buf_len; unsigned int list_length; - int ret; + s64 ret; u8 same; /* Get a buffer */