Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp620653ybh; Tue, 21 Jul 2020 03:58:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy9ELGU1M5YvBrIrX1CuHRfB7LbscQm+QvMlfegWipgi3N9Y4Pz/T9+/MROwJAEmwraY67 X-Received: by 2002:a05:6402:1ca6:: with SMTP id cz6mr24288604edb.171.1595329104519; Tue, 21 Jul 2020 03:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595329104; cv=none; d=google.com; s=arc-20160816; b=d/EpC6aG489VQS1XDZimWE6+SHYxA1uxQBYcx9Gbtl7FeBaryhD6Epa2uLSNeZGDx1 SpfcNjlKwG7tHRZOZPVnCW5mQ18WzqM6p//csjBJTjJ5bk2fFNZS2md3V43ycPoY0VqT LeL84IIBe1Hr57UwfySc/EQAqY5AtiF4Kin3lfSI1nMCyierIT5udJi7fLF8K+dSgEuG XlPJJKrhxJOl1tTQ0p5kv4O/BMTaSdhvHAPLBTZDxAHA2uloak5CPg7cBhr7AjzIwdlZ k2sTshg7y/U8hKbr1D07wWZVt1Km8OrR2Pc5gy1UDK+kg3QDJ016hBybqbslTCQs2Hls YeJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xgMI0PUysaqC29ZhpllDxU2MZgp5OTSppOCpTSOb14s=; b=ou8tV04DrHsdpA9Nojq1mhufftt14uc0f61mh43n0xoMm54aqRt+lwt4DeDQTVlR5n IRR4LjOB+LWvjZ7O6a7iliFC0VppME4X+iAUtb1Lnp/xa/jiEZZKkKk1Ri28H3XR5TWX 49aV572ekesVPkyk1xu/El8Y0E+HnPQMC4aQrHBP4aRFnhomAbNrvNHfK5GqGS+9Y5tF /UDV5eBUWVclJ8douSdP2fmN8ZgjJ0KPem39TYJ245E8LqtDY4BX2qMzUYP9J9zEClne C0L2qAXcGQZNSxajN2HpeNGlbGjhkPAsFziHlNkwczblH6WT6WWP3DvzOmNDjpO5d00I rfLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iENp5RYg; 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 h1si12518053edv.246.2020.07.21.03.58.01; Tue, 21 Jul 2020 03:58:24 -0700 (PDT) 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=iENp5RYg; 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 S1729450AbgGUKzK (ORCPT + 99 others); Tue, 21 Jul 2020 06:55:10 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23428 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728028AbgGUKzH (ORCPT ); Tue, 21 Jul 2020 06:55:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595328906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xgMI0PUysaqC29ZhpllDxU2MZgp5OTSppOCpTSOb14s=; b=iENp5RYgkobV05XdgINqkEbMNJP39F6IHiz+tF3/3N5vXcfm7hSqbnji1AL6HW3UGPhMDg ZnU4jiia9LzG7hycsrsh/uWa2vdVbjf3CkxibVTGo1OB2ofCNXljk7wfjeqeGCSHdTO7vd ifNVtpjXFD7YOa7kUEa7D8DPeKi5M7c= 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-288-aJsSQekbMPSFFHYbUkQrHg-1; Tue, 21 Jul 2020 06:55:03 -0400 X-MC-Unique: aJsSQekbMPSFFHYbUkQrHg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF672107ACCA; Tue, 21 Jul 2020 10:54:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23A671C4; Tue, 21 Jul 2020 10:54:49 +0000 (UTC) From: Maxim Levitsky To: linux-kernel@vger.kernel.org Cc: Keith Busch , Josef Bacik , linux-block@vger.kernel.org (open list:BLOCK LAYER), Sagi Grimberg , Jens Axboe , linux-nvme@lists.infradead.org (open list:NVM EXPRESS DRIVER), linux-scsi@vger.kernel.org (open list:SCSI CDROM DRIVER), Tejun Heo , Bart Van Assche , "Martin K. Petersen" , Damien Le Moal , Jason Wang , Maxim Levitsky , Stefan Hajnoczi , Colin Ian King , "Michael S. Tsirkin" , Paolo Bonzini , Ulf Hansson , Ajay Joshi , Ming Lei , linux-mmc@vger.kernel.org (open list:SONY MEMORYSTICK SUBSYSTEM), Christoph Hellwig , Satya Tangirala , nbd@other.debian.org (open list:NETWORK BLOCK DEVICE (NBD)), Hou Tao , Jens Axboe , virtualization@lists.linux-foundation.org (open list:VIRTIO CORE AND NET DRIVERS), "James E.J. Bottomley" , Alex Dubov , Maxim Levitsky Subject: [PATCH 07/10] block: mspro_blk: use blk_is_valid_logical_block_size Date: Tue, 21 Jul 2020 13:52:36 +0300 Message-Id: <20200721105239.8270-8-mlevitsk@redhat.com> In-Reply-To: <20200721105239.8270-1-mlevitsk@redhat.com> References: <20200721105239.8270-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Maxim Levitsky --- drivers/memstick/core/mspro_block.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index cd6b8d4f23350..86c9eb0aef512 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c @@ -1199,6 +1199,12 @@ static int mspro_block_init_disk(struct memstick_dev *card) msb->page_size = be16_to_cpu(sys_info->unit_size); + if (!(blk_is_valid_logical_block_size(msb->page_size))) { + dev_warn(&card->dev, + "unsupported block size %d", msb->page_size); + return -EINVAL; + } + mutex_lock(&mspro_block_disk_lock); disk_id = idr_alloc(&mspro_block_disk_idr, card, 0, 256, GFP_KERNEL); mutex_unlock(&mspro_block_disk_lock); -- 2.26.2