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: <ea11fea30903020015x4dad07c2pf369a9fbbee9c9cc@mail.gmail.com>
Date:	Mon, 2 Mar 2009 13:45:16 +0530
From:	Manish Katiyar <mkatiyar@...il.com>
To:	Andreas Dilger <adilger@....com>
Cc:	ext4 <linux-ext4@...r.kernel.org>
Subject: Re: Checking of NULL with __GFP_NOFAIL in kzalloc()

On Mon, Mar 2, 2009 at 1:05 PM, Andreas Dilger <adilger@....com> wrote:
> On Mar 02, 2009  11:38 +0530, Manish Katiyar wrote:
>> On Sun, Mar 1, 2009 at 11:35 AM, Manish Katiyar <mkatiyar@...il.com> wrote:
>> > While going through jbd code, I was wondering why do we need to check
>> > new_transaction for NULL, if we are passing __GFP_NOFAIL ?
>> > Last code change around this code was when Ted converted kmalloc to
>> > kzalloc, but since he also didn't remove it I am guessing there would
>> > be some good reason for it. Can someone enlighten me ?
>>
>> I didn't receive any response to this. So probably removing the NULL
>> check is harmless. Or should I remove the __GFP_NOFAIL flag and keep
>> the error handling ?
>
> Neither, please.  The NULL check is harmless, and static code checkers
> will complain about k[zm]alloc() without a corresponding NULL check.

Ohh... Ok.. Thanks Andreas, I didn't think about static code checkers.
Please ignore the sent patch.

Thanks -
Manish

> Branch prediction will get this right, so the overhead is miniscule.
>
>> > start_this_handle() {
>> > ..........
>> >        ..........
>> >        new_transaction = kzalloc(sizeof(*new_transaction),
>> >                        GFP_NOFS|__GFP_NOFAIL);
>> >        if (!new_transaction) {
>> >                ret = -ENOMEM;
>> >                goto out;
>> >        }
>> >        ..........
>> > }
>
> Cheers, Andreas
> --
> Andreas Dilger
> Sr. Staff Engineer, Lustre Group
> Sun Microsystems of Canada, Inc.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ