lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201103025247.GA2875@sol.localdomain>
Date:   Mon, 2 Nov 2020 18:52:47 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     Robin Hsu <robinhsu@...gle.com>
Cc:     linux-f2fs-devel@...ts.sourceforge.net, jaegeuk@...nel.org,
        chao@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [f2fs-dev] [PATCH 1/1] f2fs-toos:fsck.f2fs Fix bad return value

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 <robinhsu@...gle.com>
> ---
>  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);
	   ^~~~~~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ