Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5393186ybg; Tue, 22 Oct 2019 02:32:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQvis2+Nc1V3CBdIXcqJo8awEAhsEHkVscr+lc9+F+KfOKi5KfHj//Zyk6kWH9a9k+ygJ+ X-Received: by 2002:a17:906:3415:: with SMTP id c21mr26947875ejb.190.1571736737415; Tue, 22 Oct 2019 02:32:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571736737; cv=pass; d=google.com; s=arc-20160816; b=dTSLB8kLPkgrwTVg7T38UsnNXBKQE0IFBPLVVcPyUXxb6Lfxw2NRH5Mi7DjxBQWzRO LvsLixtMDc3tPlTO3Sk8YTsUOmO8dA8hP2eOTtMpEuu+yllNUvlWvirlXpOBrD+B7N0y EXZ/umZlaEBnInfQ8IG5DCb5o+N1+iWdFmlF8OkUv34nA8piEKMB+yrB5Zn3hLm/y38R Ge/cLvpEBASvc2qZi7aPeW8jrT1DFbcCaebH6zWjk4EuCVN9QlysTsqqkzFprLf/Emlp KWH+5xe1NMsx25/sBkpVv795/IzrJFWbIP0FIEEyNqave3bhYVUeRos2jidbNnS9vaVD GCTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:subject:message-id:cc:to:from:dkim-signature; bh=Z3nUGkAA3XNVPbgALGAPttn65zEYTMxdYqcinEjIfGQ=; b=hZSaPOxYcp0E/e/mpE6O0HdCf5Q/X9qlL3Z/Fd5wsy6e62Tw/m5j5VoHSqxVCL72GY JEmv4bh54JFeliqg5R+Gff+ii2l2RhoCnUntAZ4SsxO5Iiac5XZ4WnCT0DoPWlGO934Z kUugzd8onGHIYFs0RgdWdOkvDBYuiZKxz+TvnN+6qiZpFJsllQjxFTdOsvlcasJA6qUG kWcwLmzHm1iiHOz0vZDbDSisLb8ucVUTRcxnfQZzuJxwdFcuuuTh1dYupzLXoUy8NWPH IwhgfDQ85c1ZXvh7E4WpVluKrcJnm2LJyEot8+ggKf43zfKulYin9VnAvgJtZH2M4ESt gDCw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=XZWXQKjE; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 cb5si4731791ejb.270.2019.10.22.02.31.52; Tue, 22 Oct 2019 02:32:17 -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; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=XZWXQKjE; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 S1731229AbfJVJ1q (ORCPT + 99 others); Tue, 22 Oct 2019 05:27:46 -0400 Received: from sender2-of-o52.zoho.com.cn ([163.53.93.247]:21129 "EHLO sender2-of-o52.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731397AbfJVJ1q (ORCPT ); Tue, 22 Oct 2019 05:27:46 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1571736460; cv=none; d=zoho.com.cn; s=zohoarc; b=AwO29ivo4Fow7ulkLO/sTV1SPQf/ID0zdw1eOEzxuQFGVsdKxMUMDfOgkGk7Z9Cx8hcicDwFFVo0yoN9n8hetG7izjtWOY52pKi1I+19Sh0U5g8nQCLAY8hmggD1Rzx+mc0UjcG+wIahdg6pMXZfJ0te2p/wFWT3NaNX1MjkMio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1571736460; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To:ARC-Authentication-Results; bh=Z3nUGkAA3XNVPbgALGAPttn65zEYTMxdYqcinEjIfGQ=; b=IZVzO9QNj+BprBx0Iw2MYQsvcJUumv5wDGKTK9/U9/mnmPPxpOu1N6c8ktMlRi8u9kgIkpe73xNG9Ds7DT4NrrmZy4ubLJFgocVLEpyWMrnt+XZnnTGMp8wZJOQBTv896NhrqxFs09p7vRfWDOnlJiUvh8JRifk6pa/HjjOaM18= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1571736460; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; l=618; bh=Z3nUGkAA3XNVPbgALGAPttn65zEYTMxdYqcinEjIfGQ=; b=XZWXQKjE7gO/dxcx+4m6ge0/E9arFpMIMdeILYQ8UXd8DWT4Py5NQfkHDvpa4YoX ROJ4wrFqbWQvRIzDHsccixibBrqX8TptXg92AbpDEg/2wcF0cVZezXCDfnvrcdERTix q6t2JM6R9lrrVYcMV/k+y+Sed9oqXjmlLLqxPnL8= Received: from localhost.localdomain (218.18.229.179 [218.18.229.179]) by mx.zoho.com.cn with SMTPS id 157173645815319.38959495323263; Tue, 22 Oct 2019 17:27:38 +0800 (CST) From: Chengguang Xu To: jack@suse.com Cc: linux-ext4@vger.kernel.org, Chengguang Xu Message-ID: <20191022092720.24416-1-cgxu519@mykernel.net> Subject: [PATCH] ext2: don't set count in the case of failure Date: Tue, 22 Oct 2019 17:27:20 +0800 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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, =09*count =3D num; =09return grp_goal - num; fail_access: -=09*count =3D num; =09return -1; } =20 --=20 2.20.1