Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 30, 2014 at 10:24:47AM -0400, Sasha Levin wrote:
> On 10/30/2014 10:14 AM, Johannes Weiner wrote:
> >> The problem is that you are attempting to read 'locked' when you call
> >> > mem_cgroup_end_page_stat(), so it gets used even before you enter the
> >> > function - and using uninitialized variables is undefined.
> > We are not using that value anywhere if !memcg.  What path are you
> > referring to?
> 
> You're using that value as soon as you are passing it to a function, it
> doesn't matter what happens inside that function.

It's copied as part of the pass-by-value protocol, but we really don't
do anything with it.  So why does it matter?

> >> > Yes, it's a compiler warning.
> > Could you provide that please, including arch, and gcc version?
> 
> On x86,
> 
> $ gcc --version
> gcc (GCC) 5.0.0 20141029 (experimental)
> 
> [   26.868116] ================================================================================
> [   26.870376] UBSan: Undefined behaviour in mm/rmap.c:1084:2

Well, "compiler warning" is misleading at best, this is some
out-of-tree runtime debugging tool.

As per above, there isn't a practical problem here, but your patch
worsens the code by making callsites ignorant of how the interface
works.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]