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: <5418df56f217437bd33c4cb70098db29c177d5b3.camel@perches.com>
Date:   Thu, 28 May 2020 19:03:45 -0700
From:   Joe Perches <joe@...ches.com>
To:     Yi Wang <wang.yi59@....com.cn>, clm@...com
Cc:     josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        xue.zhihong@....com.cn, wang.liang82@....com.cn,
        Liao Pingfang <liao.pingfang@....com.cn>
Subject: Re: [PATCH] btrfs: Replace kmalloc with kzalloc in the error message

On Fri, 2020-05-29 at 09:00 +0800, Yi Wang wrote:
> From: Liao Pingfang <liao.pingfang@....com.cn>
> 
> Use kzalloc instead of kmalloc in the error message according to
> the previous kzalloc() call.
[]
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
[]
> @@ -632,7 +632,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state,
>  
>  	selected_super = kzalloc(sizeof(*selected_super), GFP_NOFS);
>  	if (NULL == selected_super) {
> -		pr_info("btrfsic: error, kmalloc failed!\n");
> +		pr_info("btrfsic: error, kzalloc failed!\n");

As there is a dump_stack() done on memory allocation
failures, these messages might as well be deleted instead.

>  		return -ENOMEM;
>  	}
>  
> @@ -795,7 +795,7 @@ static int btrfsic_process_superblock_dev_mirror(
>  	if (NULL == superblock_tmp) {
>  		superblock_tmp = btrfsic_block_alloc();
>  		if (NULL == superblock_tmp) {
> -			pr_info("btrfsic: error, kmalloc failed!\n");
> +			pr_info("btrfsic: error, kzalloc failed!\n");

If these are really desired, it'd be likely be better
to describe the function that failed instead of whatever
internal memory allocation the function used.

Another option would be to add __GFP_NOWARN to the
allocation internal to btrfsic_block_alloc and then
change this to something like

		pr_info("btrfsic: error, btrfsic_block_alloc failed!\n");						}

or move this reporting into the btrfsic_block_alloc
function and remove the messages after each failure.

etc...


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ