Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp214254pxb; Mon, 2 Nov 2020 19:26:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzH94q9f1xhZhkjII8gHbmnmsQqe4rbItiug0NMQtdJexKlQ1kOsaAGxz9ibq2Ih2CNLX8k X-Received: by 2002:a17:906:66d2:: with SMTP id k18mr17629455ejp.113.1604373972442; Mon, 02 Nov 2020 19:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604373972; cv=none; d=google.com; s=arc-20160816; b=JvHj+PTUwBPuTy2YWEabZ1hPOKzmzHrHuV6Wkf4BYaCAZzckYScc3BX7eEIsLiAHWv IU2SyfF135X2nRPOEBDCnp9ZkfqpD45iw6HponZFLaG0US8kcUL6GiH+uBFIKOhbI7nZ t3i20hrnVT9byzuExBGl0+qmnH6FQEC6Uqdplsnk8pf7ma7aP9P3t2FQbwn4J30sCkjw IsRUDHAi9AU/MCg2wD1BaA7339ROQzRMZrGzHRAURO6dkz/CaDQC6GJOM1/AgCHH9ZDL aFmJYDbqWV16PGFCoQMwhbXKdNIg96QjMip7UhWw0TezI4cNJ6uJjN8vYzf4rtLbzefP uNlw== 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=Nvt9duR7jYqFG+g62WemIliT+o+J6W+2Pycw4tig720=; b=RhwO4gguvSNqHECnvowNkFXN/jen27YGABnB8T7UGUA32wp4GBPX30Bb6FJBczK+wF yBu1iaOtSsziF0Fw3Pf1i15MZAtnWI+8BCcWw5lAOsVjpQVNV3Ljjg5ILtQSO2z32Ok9 SoBZFUf8AkJq9cvn/Df/qKl0531ZB7KKD+BP2wak94ZHIp3ELm6NdDKVLFk7/2Otzce1 DUEbBfeiuu5QeMssW6ohDzICN3uI0Q2xWHYIQ4gg47Eu9WDH/3kq3jkKWez1GP8eVRtq XEBPjKzDzlgCUnS7mT14b9pDQoEMdpHxr8IUcUwpkY3Mc3oQkmtcb/Ei1IfiWqAKt4cY BNrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=romb8T+K; 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 ce9si10663354ejb.713.2020.11.02.19.25.49; Mon, 02 Nov 2020 19:26:12 -0800 (PST) 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=default header.b=romb8T+K; 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 S1727043AbgKCDXa (ORCPT + 99 others); Mon, 2 Nov 2020 22:23:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:33830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbgKCDXa (ORCPT ); Mon, 2 Nov 2020 22:23:30 -0500 Received: from google.com (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26346207BB; Tue, 3 Nov 2020 03:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604373809; bh=p9rQmVDxvvOszEjaGQDBK6m2fDZWjD12qwvk598JVQo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=romb8T+KHa9yqXJuEAfFU3ZMyx5vMFDr8jG5yMmi3f1CJQh5/UdbHkmS8/wva9xGW FXqFwCR7K3E77PkmywIWEGD2zzhLB6FWqwJ7g1+vQdYKegYya+CnEinjvmEMDdpubY GFvyoxxslp+X639eSvUxjnlHalzaOr7kNDvcT9gQ= Date: Mon, 2 Nov 2020 19:23:27 -0800 From: Jaegeuk Kim To: Eric Biggers Cc: Robin Hsu , linux-f2fs-devel@lists.sourceforge.net, chao@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [f2fs-dev] [PATCH 1/1] f2fs-toos:fsck.f2fs Fix bad return value Message-ID: <20201103032327.GA3655802@google.com> References: <20201026094000.1500425-1-robinhsu@google.com> <20201103025247.GA2875@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103025247.GA2875@sol.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/02, Eric Biggers wrote: > On Mon, Oct 26, 2020 at 05:40:00PM +0800, Robin Hsu via Linux-f2fs-devel wrote: > > 'ret' should not have been used here: otherwise, it would be wrongly used > > as the error code and then be returned from main(). > > > > Signed-off-by: Robin Hsu > > --- > > fsck/fsck.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/fsck/fsck.c b/fsck/fsck.c > > index f97e9fb..66e4e3f 100644 > > --- a/fsck/fsck.c > > +++ b/fsck/fsck.c > > @@ -3137,8 +3137,7 @@ int fsck_verify(struct f2fs_sb_info *sbi) > > char ans[255] = {0}; > > > > printf("\nDo you want to restore lost files into ./lost_found/? [Y/N] "); > > - ret = scanf("%s", ans); > > - ASSERT(ret >= 0); > > + ASSERT(scanf("%s", ans) >= 0); > > if (!strcasecmp(ans, "y")) { > > for (i = 0; i < fsck->nr_nat_entries; i++) { > > if (f2fs_test_bit(i, fsck->nat_area_bitmap)) > > This patch causes a compiler warning: > > In file included from f2fs.h:33, > from fsck.h:14, > from fsck.c:11: > fsck.c: In function 'fsck_verify': > ../include/f2fs_fs.h:197:11: warning: format '%s' expects a matching 'char *' argument [-Wformat=] > printf("[ASSERT] (%s:%4d) " #exp"\n", \ > ^~~~~~~~~~~~~~~~~~~~ > fsck.c:3151:3: note: in expansion of macro 'ASSERT' > ASSERT(scanf("%s", ans) >= 0); > ^~~~~~ Urg. Fixed by this. From c986140e3c5abb9eb7a08928a88acb8273f1bd52 Mon Sep 17 00:00:00 2001 From: Robin Hsu Date: Mon, 26 Oct 2020 17:40:00 +0800 Subject: [PATCH] f2fs-toos: fsck.f2fs Fix bad return value 'ret' should not have been used here: otherwise, it would be wrongly used as the error code and then be returned from main(). Signed-off-by: Robin Hsu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fsck/fsck.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 647523397f3e..e52672032d2c 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -3146,10 +3146,11 @@ int fsck_verify(struct f2fs_sb_info *sbi) #ifndef WITH_ANDROID if (nr_unref_nid && !c.ro) { char ans[255] = {0}; + int res; printf("\nDo you want to restore lost files into ./lost_found/? [Y/N] "); - ret = scanf("%s", ans); - ASSERT(ret >= 0); + res = scanf("%s", ans); + ASSERT(res >= 0); if (!strcasecmp(ans, "y")) { for (i = 0; i < fsck->nr_nat_entries; i++) { if (f2fs_test_bit(i, fsck->nat_area_bitmap)) -- 2.29.1.341.ge80a0c044ae-goog