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] [day] [month] [year] [list]
Date:   Wed, 26 May 2021 18:29:02 -0400
From:   Waiman Long <llong@...hat.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...nel.org>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
        linux-mm@...ck.org, Muchun Song <songmuchun@...edance.com>
Subject: Re: [PATCH-next] mm/memcontrol.c: Fix potential uninitialized
 variable warning

On 5/26/21 4:43 PM, Andrew Morton wrote:
> On Wed, 26 May 2021 15:36:02 -0400 Waiman Long <longman@...hat.com> wrote:
>
>> If the -Wno-maybe-uninitialized gcc option is not specified, compilation
>> of memcontrol.c may generate the following warnings:
>>
>> mm/memcontrol.c: In function ‘refill_obj_stock’:
>> ./arch/x86/include/asm/irqflags.h:127:17: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>    return !(flags & X86_EFLAGS_IF);
>>            ~~~~~~~^~~~~~~~~~~~~~~~
>> mm/memcontrol.c:3216:16: note: ‘flags’ was declared here
>>    unsigned long flags;
>>                  ^~~~~
>> In file included from mm/memcontrol.c:29:
>> mm/memcontrol.c: In function ‘uncharge_page’:
>> ./include/linux/memcontrol.h:797:2: warning: ‘objcg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>    percpu_ref_put(&objcg->refcnt);
>>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Fix that by properly initializing *pflags in get_obj_stock() and
>> introducing a use_objcg bool variable in uncharge_page() to avoid
>> potentially accessing the struct page data twice.
>>
> Thanks.  I'll queue this as a fix against your "mm/memcg: optimize user
> context object stock access".
>
Thanks for that.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ