Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1037609pxv; Thu, 15 Jul 2021 23:34:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4LHbKkdpanFGf0VFpIp0AWEocYqDdG4N7XlSC8yov3t/9BZEsmVic8mEa1XFmFULJQlzB X-Received: by 2002:a05:6e02:2194:: with SMTP id j20mr5601058ila.108.1626417296118; Thu, 15 Jul 2021 23:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626417296; cv=none; d=google.com; s=arc-20160816; b=SGoy/3WazCjW/PAP2vCWCCH/0L96tKumX98QM5jIUIV7rUW8N6vIQHWXh0w0YattRM WN/LRChzwO1SPtfKvlmp6dHIiJqZxPYcQ2yjrvZUYNWYE/QDuuDNUdkW+rM+wgEnIK5u p/WJduAoBPwqSePaeKaHKbCSF14sy0Uih28IO+FogENdbunp9JhOYV1YEJoZzFz8oH6h p0eeydcH1MfJaDNrRHbJ9jpidUKIrKJxebXpQFG9DY1sxVVF86dhp/Y0xG43oe7q4I+n AC+MCD8OpIsJJ6gZ9ZmseCfDtvfi8MvHByoQodcZEuCXOH/doDXYdnYojZq3YCEb1kvA 65DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=dGFzC+WEJCXbsqIYKpOrRXgSVbfROcgGBgRP5Ke9YMs=; b=oKnivhUr8qcOXT6vL+I9FZ/l91XbDcwuNOTYMWx5Lx46vUhd++vWmCW4crubtHGc9X D+MGl+VQWu+JHfzGS+KH7oPsRLwjv7TTwORPgG/C0A2dj8IpipiwmCdWfC5RbD5nYcEd Ejyzgb3K+BY876pSJMBUn9nbDtfh2GijR4Kh+49GNrx5IjgLzkK2qnz/cAdfrJAyA1sr 8tzNbmla7DWNZlJMBEmaF9c7VSw1KvSb3L5uiRcHQPGpfxSGNZ3MEhoGx4ZYSxQS4GG/ HYE5Jm4lv6oCV3Uq21CJHOKudCxtO1ZlhBTRv9/EYPLyw0seGF3DktJzC4ucKUpi0uSm KUuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si9712692jad.24.2021.07.15.23.34.44; Thu, 15 Jul 2021 23:34:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235273AbhGPGg3 (ORCPT + 99 others); Fri, 16 Jul 2021 02:36:29 -0400 Received: from verein.lst.de ([213.95.11.211]:41976 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234896AbhGPGg3 (ORCPT ); Fri, 16 Jul 2021 02:36:29 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id C874467373; Fri, 16 Jul 2021 08:33:32 +0200 (CEST) Date: Fri, 16 Jul 2021 08:33:32 +0200 From: Christoph Hellwig To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, Christoph Hellwig , Marek Szyprowski , Robin Murphy , Stephen Bates , Martin Oliveira Subject: Re: [PATCH v1 16/16] dma-mapping: Disallow .map_sg operations from returning zero on error Message-ID: <20210716063332.GD13345@lst.de> References: <20210715164544.6827-1-logang@deltatee.com> <20210715164544.6827-17-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715164544.6827-17-logang@deltatee.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 10:45:44AM -0600, Logan Gunthorpe wrote: > @@ -194,6 +194,8 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, > else > ents = ops->map_sg(dev, sg, nents, dir, attrs); > > + WARN_ON_ONCE(ents == 0); Turns this into a negative error code while we're at it, just to keep the callers sane?