Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1129412pxb; Thu, 15 Apr 2021 15:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2zVxgZJOfymFqKYyV6p3vOQfkkuCEbEWz5yczEo9QFV0xQKsolPkvSjVrbGu3lQrmuzxX X-Received: by 2002:a17:906:8293:: with SMTP id h19mr5557986ejx.217.1618524210711; Thu, 15 Apr 2021 15:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618524210; cv=none; d=google.com; s=arc-20160816; b=fK76xyYdCi1KE8ti38kbL1U78iQEpDNNfzAewO5BP6kIm9fwsi0Oz6FOe2+eQ2mpk0 2u92JB8JO8D0IwpNKz6zMQ+BdSgfCl11NFb05uHZn4AYSBJRCCY6Okoc2BC8oVQ+0aVx Afcl0iFtbO+AQ0j5f+k3VsPUUY7G7b9GMFFUFXP0GxtsG4jR/u2K0OUnB2DFzVifJ2i4 aQGCOV9kq+hmCJlGkESipW/9wOup+Ewc7l3k3+EPoFWaOeblCUTVtiOv4ZTpgPKWr15s 81Ezrh6QSyh5eUfXBuDJzngmu18256T0dATDHjDQnFtro6twxfcFAbmD9657vyeNCVc5 ndQA== 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=hNgh1nC+KYuZfGhrgJkOJ1+hrrnvMoH12+z3E4VXnrs=; b=szeCmR1Af2UjZolSvTa5JvVhLzwWtXT+mFKzxxQLXbPbHcACZUJCWSZ8C7FoTP6RLp F5jAuMYBoRDkf6buJmcA6fUbfhdjvqQ67bqaKMqhmRyjfa632zm0J8uOJJQ97zqbOxLd HObAxr52Kf1f1emfO+gycgTLP5G8EHqDzuaSGoctYASMWfHFapi0rQWzNS1bWsWU/4hO wEs1vt7L6omoE21tk/KAxplATb7H2Kat6oTJ8qCTejpSpWVBm3/MWfxUUA/CHhvWUwV/ NH3CY47MMNoCcbTLJBi4Gf8EpWP08iSQMdLtYTfhUdFAR4Ai/uNVzJCZH+QfXmPwfcYv 0YVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u7o2RovI; 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 bz20si3294137ejc.706.2021.04.15.15.03.07; Thu, 15 Apr 2021 15:03:30 -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=u7o2RovI; 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 S235216AbhDOUAw (ORCPT + 99 others); Thu, 15 Apr 2021 16:00:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234654AbhDOUAw (ORCPT ); Thu, 15 Apr 2021 16:00:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97EE461153; Thu, 15 Apr 2021 20:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618516828; bh=YdzC93TtVE0c8gSNhfkcwHAO6LR0ZLhJPv1nFw9o45U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u7o2RovIlzGObUUhH07Y1exQskWumZNUgqDq4bgFaqR7ntEHTgOfA0pgEXAF6s0s4 utjLFEu5T3PDeGrp0WbEQavlsjP8l8t6MRJ8rxu+xUJyj6QuGWrVSQoMJ5/NltNaJ5 KrU/OwCXCsCwQCcEGjehonlj1/SjJF+nUIF3PGFXmxfXFotXw5OjgPbMdXbiyDjfm1 tkOcVuo6omwn/xXif89D4xiFhIV5KUZ+oxYhUcSREu0Wlcy4HZL5lfvyHk5/acx0TO ZdpF1W09qKOJAkO02sZ/tbrPSiSBZf3UEs6+C5n2OCp8wbngm9ZrvcJO7Q7SrrH1fy Eh1lhfGSz1QNA== Date: Thu, 15 Apr 2021 13:00:27 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: Re: [PATCH v2 8/8] block: add WARN() in bio_split() for sector alignment Message-ID: References: <20210325212609.492188-1-satyat@google.com> <20210325212609.492188-9-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210325212609.492188-9-satyat@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 09:26:09PM +0000, Satya Tangirala wrote: > The number of sectors passed to bio_split() should be aligned to > bio_required_sector_alignment(). All callers (other than bounce.c) have > been updated to ensure this, so add a WARN() if the number of sectors is > not aligned. (bounce.c was not updated since it's legacy code that > won't interact with inline encryption). What does bounce.c "won't interact with inline encryption" mean, exactly? Devices that enable bounce buffering won't declare inline encryption support, so bounce.c will never see a bio that has an encryption context? > diff --git a/block/bio.c b/block/bio.c > index 26b7f721cda8..cb348f134a15 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -1458,6 +1458,7 @@ struct bio *bio_split(struct bio *bio, int sectors, > > BUG_ON(sectors <= 0); > BUG_ON(sectors >= bio_sectors(bio)); > + WARN_ON(!IS_ALIGNED(sectors, bio_required_sector_alignment(bio))); If this warning triggers, shouldn't the function return NULL to indicate a failure rather than proceeding on? - Eric