Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4094551ybg; Fri, 25 Oct 2019 13:14:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaJwbsFe/cQ+gPmCl8sNG4L9ijreqTmAPpZTEmrtW64uR1BeN2LXfuwalIbXHQBj3sufon X-Received: by 2002:a17:906:184e:: with SMTP id w14mr5230738eje.10.1572034467589; Fri, 25 Oct 2019 13:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572034467; cv=none; d=google.com; s=arc-20160816; b=LGGxg6BXhJF7dSfbUi3sehF3hlKvKX1FTa4U/bt/yTJu99gJ3RqchvCvIksdUCjlt0 hiKY7m8uiXbMqr1l4iAzs5iBZNYJCkroKZFZ5Y/1jaUrr7NEjS+LwZl7jVQLFGrME7H3 HiSC1SZN05x2G4Nz6kO2vyf3lqIrvvJugNhMAH8CcJ1qjEnVYa0YFjcZ84h2orr4p4mI APzF0gpDkTKeY1PT4CAn9M6UQS2uvWzVGRdoEoTpbo6B9XDZ+EVL9Jb9RsEbOxnqCzUK C544wQ8ScLpQscWxo99EZ9OmVQYhExycEd0MepYdCegiWIGwugmKZ0IoiuBJxsQZMvfh PaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ecCJLUw2qw7/YR9nMvurKM76G0/3F2ZNF2FJ1TOqKsc=; b=ZgWVDtoZWFE80QcHqdRwfzuIlvPsgpx51VxGUp3c/Tt7wq19gc+ru6+TbBr69S+onq cuzOx7yiapwB6rbw8riifDynV0yFMw7mi+mgdus+PfeuX084cRWg/lvMVYxLeUS8k0pk KhtWZLGjhjCjfWZG+DPaORpl2ZcktzvdUxbrfKyShepmewYGHh6df/1PG4WPQcGCrojl V3cbVcEBMgua/0hRsb2nYZZCpYeeFjKMvG22YZmZo0k3mTC3JMrqABwNUdXF23t1xMgq BqYhXZG1ovIRN/Yel8xDQP8U2v6VqTxOuKr20YNXHmfemeCWy1ylhzqjUOX4rHxpIXQl w5BQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16si1654845edb.23.2019.10.25.13.13.52; Fri, 25 Oct 2019 13:14:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439473AbfJYNKK (ORCPT + 99 others); Fri, 25 Oct 2019 09:10:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:38220 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439018AbfJYNKK (ORCPT ); Fri, 25 Oct 2019 09:10:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B1F92B29C; Fri, 25 Oct 2019 13:10:08 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E3E811E4852; Fri, 25 Oct 2019 15:02:37 +0200 (CEST) Date: Fri, 25 Oct 2019 15:02:37 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext2: don't set count in the case of failure Message-ID: <20191025130237.GA30163@quack2.suse.cz> References: <20191022092720.24416-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022092720.24416-1-cgxu519@mykernel.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 22-10-19 17:27:20, Chengguang Xu wrote: > In the case of failure, the num is still initialized value 0 > so we should not set it to *count because it will bring > unexpected side effect to the caller. > > Signed-off-by: Chengguang Xu Looks good to me but please ellaborate a bit in the changelog what are visible effects of this bug. Thanks! Honza > --- > fs/ext2/balloc.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c > index 18e75adcd2f6..cc516c7b7974 100644 > --- a/fs/ext2/balloc.c > +++ b/fs/ext2/balloc.c > @@ -736,7 +736,6 @@ ext2_try_to_allocate(struct super_block *sb, int group, > *count = num; > return grp_goal - num; > fail_access: > - *count = num; > return -1; > } > > -- > 2.20.1 > > > -- Jan Kara SUSE Labs, CR