Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1531118pxv; Fri, 23 Jul 2021 10:32:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAyANvN/yOboT2/QQveZuimM2TMXrtlnx5AlByfu3Zn1oYml7R4Zdb+KBVvootcO/Qx6Dm X-Received: by 2002:aa7:c907:: with SMTP id b7mr6832713edt.148.1627061558868; Fri, 23 Jul 2021 10:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627061558; cv=none; d=google.com; s=arc-20160816; b=ZRg7Ooj7MHxkQIohotdpZdbfTi1lFzPntuLdPf2et09iC6EgLVImrnsEW5RNpiMFpy 8eZXokm5th+apJbCWmXbU5C1Y06j+/1lm2IdKFH4Lz30foIFzAPac+YEs+dAblencRuS WL8ghZroYauSQQ5HHaT2jl6k/xdrQvm9+lMbU+qa0yb/1DCxBoFdTEJOkmN1nlGQzHsr IBC3Xu4lem+wwgwjvpxRBRHZy6r74xcmyVXNTKlE17u0h4Yh5QR8816T1SpsRN6fbtf2 rdz7QDGmQF3zPbEW3RshAArOXgM4BlRmojGLI0UM3J6fylgk101d8ytlBEsS6LdJB/oy VtXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XHq7otfoTaBDvdMIonvGPhZxYyqaVweIZ3cJra/WXr0=; b=0uzx9kJIX3dPG3k7Kehln5HbK0FpsIlO8F9dRKpHziPBBCT9eN/Zl3JxxnpPycXFaQ ddn8NO/dGZeNbiqvVHKfcz4+BJfP2jtaduyQ169z9nV8GYywElcuW1SS2wcqR5M3ROhZ 8Zszg5dWx+mGOat0R9IY3KgGGifwWFn/Sp1Y1oOLIgqbscfcDtrMnLnYwKqZmMX7DnNx Oj51oOJTgf9LRPBAuUBk3EfIBptFeCzr6WSLs7bmXBvPoJwocTdLT/enD+o4KGg5XcJT /rz0nZNUy2p1b7H/IyjmpNDlmTclIibojsg4npB7ttZFBc+PQTlK+y4sXfrcntrN/Bus U9rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N3CKUYxi; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c27si5577132ejb.475.2021.07.23.10.32.14; Fri, 23 Jul 2021 10:32:38 -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=@kernel.org header.s=k20201202 header.b=N3CKUYxi; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbhGWQuN (ORCPT + 99 others); Fri, 23 Jul 2021 12:50:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:46208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbhGWQuM (ORCPT ); Fri, 23 Jul 2021 12:50:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E73760EB4; Fri, 23 Jul 2021 17:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627061445; bh=fTHDLla3VU2ApOlEPZLBX3MOoVxOP6SWQW5g3oZuKM4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N3CKUYxiL5NuZ1YgChzwR4kyXJYgWneQMbpQpMhMpc9GMnVYBFe0+0214nvxGP0Oe pS0FRqLwqSkMr+DgiQyx+tuzqmr28IB5u+HWhGTMGyUicskVDJz2h2ThFmI6GT4CXR 3TZafadYWU5vArUdwZ6wKpoV5kwfmqhJkY4HJhsZfrOcB6XLpUugf0m6jt53EVbcYD mXlHopLUPbaDJZBwMi7ShdTFUKGo5ECMoSFdX+XZg1GF7pHde90VC1nBWg8QevZZrx y/dowxPDsP8omTZAviy4QH1feg5cYCsonowYXBLocvqqlUSYRrxE6KiwGpQnma2ELO zR0HXgqp0Ocmw== Date: Fri, 23 Jul 2021 10:30:44 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , Satya Tangirala Subject: Re: [PATCH v4 9/9] block: add WARN_ON_ONCE() to bio_split() for sector alignment Message-ID: References: <20210707052943.3960-1-satyaprateek2357@gmail.com> <20210707052943.3960-10-satyaprateek2357@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210707052943.3960-10-satyaprateek2357@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 06, 2021 at 10:29:43PM -0700, Satya Tangirala wrote: > From: Satya Tangirala > > The number of sectors passed to bio_split() must be aligned to > bio_required_sector_alignment(). All callers (other than bounce.c) have > been updated to ensure this, so add a WARN_ON_ONCE() if the number of > sectors is not aligned. (bounce.c was not updated since it's legacy code > - any device that enables bounce buffering won't declare inline > encryption support, so bounce.c will never see a bio with an encryption > context). The last sentence could say "so bounce.c will never see a bio with bio_required_sector_alignment() greater than the logical block size". > > Signed-off-by: Satya Tangirala > --- > block/bio.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/bio.c b/block/bio.c > index 1fab762e079b..4c7bfdeefe76 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -1435,6 +1435,7 @@ struct bio *bio_split(struct bio *bio, int sectors, > > BUG_ON(sectors <= 0); > BUG_ON(sectors >= bio_sectors(bio)); > + WARN_ON_ONCE(!IS_ALIGNED(sectors, bio_required_sector_alignment(bio))); > > /* Zone append commands cannot be split */ > if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND)) Reviewed-by: Eric Biggers - Eric