Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC9D5C433FE for ; Fri, 19 Nov 2021 17:38:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8935611CC for ; Fri, 19 Nov 2021 17:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236938AbhKSRl5 (ORCPT ); Fri, 19 Nov 2021 12:41:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:43132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236847AbhKSRlj (ORCPT ); Fri, 19 Nov 2021 12:41:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1515B611CC; Fri, 19 Nov 2021 17:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637343517; bh=g12po8D7zM6QyqCYfqVDfT9BQeF/7udg0IXK4azhfJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ae0jIPIudVT+eFOyHzqAvWAmV5gUpHwKwhlTWgHqkwgT5jotgv7q+DWMD2B9BrEom 7J2YzvZl2G4I0CAlilkXv8hWmaaZPDtBd+Cezb4cHbw11da5Fq7E4sMs5D8ajv+SkB /2wDYOfxJyFRYjlixp9zD/OPK1IhIofOEy1gsMa8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Jens Axboe , Tadeusz Struk Subject: [PATCH 5.10 03/21] loop: Use blk_validate_block_size() to validate block size Date: Fri, 19 Nov 2021 18:37:38 +0100 Message-Id: <20211119171444.002617211@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211119171443.892729043@linuxfoundation.org> References: <20211119171443.892729043@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie Yongji commit af3c570fb0df422b4906ebd11c1bf363d89961d5 upstream. Remove loop_validate_block_size() and use the block layer helper to validate block size. Signed-off-by: Xie Yongji Link: https://lore.kernel.org/r/20211026144015.188-4-xieyongji@bytedance.com Signed-off-by: Jens Axboe Cc: Tadeusz Struk Signed-off-by: Greg Kroah-Hartman --- drivers/block/loop.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -229,19 +229,6 @@ static void __loop_update_dio(struct loo } /** - * loop_validate_block_size() - validates the passed in block size - * @bsize: size to validate - */ -static int -loop_validate_block_size(unsigned short bsize) -{ - if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize)) - return -EINVAL; - - return 0; -} - -/** * loop_set_size() - sets device size and notifies userspace * @lo: struct loop_device to set the size for * @size: new size of the loop device @@ -1121,7 +1108,7 @@ static int loop_configure(struct loop_de } if (config->block_size) { - error = loop_validate_block_size(config->block_size); + error = blk_validate_block_size(config->block_size); if (error) goto out_unlock; } @@ -1617,7 +1604,7 @@ static int loop_set_block_size(struct lo if (lo->lo_state != Lo_bound) return -ENXIO; - err = loop_validate_block_size(arg); + err = blk_validate_block_size(arg); if (err) return err;