Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1446305pxb; Fri, 20 Aug 2021 05:57:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz38aCQFsGpdyhEcfISdy0LkT/REOynaHkLNZASTdQUXVw5WIy/vnpgQar/GcgLE+7jU8wH X-Received: by 2002:a17:907:3e05:: with SMTP id hp5mr21628269ejc.527.1629464246040; Fri, 20 Aug 2021 05:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629464246; cv=none; d=google.com; s=arc-20160816; b=kf0hseBr3ND7jlXG4Tjfi8P+BmOxxwqzrASbYaHa3NoiJ5sqTTxP25fi3Sbv+4znlN NOfYEwDcQRfnBOnCuyvbSI7xBXHTBp4t32znHEqYhAbEAdD40tjJkoX30djMp5isVkP/ 3nuWWBWN+mt5WQoU1rmfBF3/IMTAnsLtrpNRV3whiHfn+Qf5whHWuZMMKul38yI5+Jhq ErHKlxMPXJKNuPM38Em5iC96lGm+9DauOrlHKgTj7hpoyP42Obc+Hr6DmsARZOTwmzUp o/44mZCZ1/Ul0+5+82VcGbMpFGom6UzxtEVmCHaTWUdXLZv7PoN1aU7XFVIklaB9FNjR gLsg== 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=W/OzEmTpDuNATYwc/uCdm/27ySh4N3cz2qrodIdXbDs=; b=chnQ6cURFnnzbeZ6IfutC2a4Oi82ITJhnsOWeHijeiOOnHQsCZlQCmKzKmw392av3O su9rkY3AxsVir5mUX6bcPGmUTNXHh8CXiYczUwD2up7vLW2HSwUpyiUShFa2nWeDFZuO PNlb+t1amKox0loF6xhJQ4VXzjSIF5wa/6bMKZBKfvmCuZgs/SPSlgbM53+fQN/mNc91 PtEH/YzgOYShQzqaorggFmhyJ7jVwhOPVfxx5HFGPCX+RDaEwDqdvxtoKXjNoklzDJu1 nUB0oQesXIbRf3PCHJi0eF/WG8ZiXkUX5FsqGi4oZMk5PUxnZQFAal0Ju8T/uOHIrD6L XTRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 gt15si6372811ejb.30.2021.08.20.05.56.42; Fri, 20 Aug 2021 05:57:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240278AbhHTMyQ (ORCPT + 99 others); Fri, 20 Aug 2021 08:54:16 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:53704 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237996AbhHTMyQ (ORCPT ); Fri, 20 Aug 2021 08:54:16 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1mH41R-0007H8-An; Fri, 20 Aug 2021 20:53:21 +0800 Received: from herbert by gondobar with local (Exim 4.92) (envelope-from ) id 1mH41L-0007bK-II; Fri, 20 Aug 2021 20:53:15 +0800 Date: Fri, 20 Aug 2021 20:53:15 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: Shreyansh Chouhan , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Linux Crypto Mailing List , Linux Kernel Mailing List , syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com Subject: Re: [PATCH] crypto: xts_crypt() return if walk.nbytes is 0 Message-ID: <20210820125315.GB28484@gondor.apana.org.au> References: <20210809141027.860850-1-chouhan.shreyansh630@gmail.com> <20210820083111.GA28484@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Aug 20, 2021 at 01:14:52PM +0200, Ard Biesheuvel wrote: > > In spite of that, I have a slight preference for this version, given > that it makes it obvious that we bail on two separate conditions: > - an error has occurred > - no error has occurred but the resulting walk is empty > > Testing walk.nbytes only needlessly obfuscates the code, as we need to > return 'err' in the end anyway. I disagree, this is how most skcipher walkers are structured, they never explicitly test on err and only terminate the loop when walk->nbytes hits zero, in which case err is returned as is. I don't see why this particular skcipher walker should deviate from that paradigm. In fact it is exactly that deviation that caused the bug in the first instance. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt