[OE-core] [PATCH] mdadm: fix gcc8 maybe-uninitialized/format-overflow warning

Richard Purdie richard.purdie at linuxfoundation.org
Wed Mar 20 13:43:26 UTC 2019


On Wed, 2019-03-20 at 08:59 -0400, Khem Raj wrote:
> On Wed, Mar 20, 2019 at 1:21 AM Adrian Bunk <bunk at stusta.de> wrote:
> > On Tue, Mar 19, 2019 at 11:51:47PM -0400, Khem Raj wrote:
> > > On Fri, Mar 15, 2019 at 6:45 AM Adrian Bunk <bunk at stusta.de>
> > > wrote:
> > > > On Tue, Mar 12, 2019 at 05:41:58PM +0800, 
> > > > changqing.li at windriver.com wrote:
> > > > > From: Changqing Li <changqing.li at windriver.com>
> > > > > 
> > > > > while compiled with -Werror=maybe-uninitialized/-
> > > > > Werror=format-overflow=,
> > > > > it failed
> > > > > 
> > > > > [snip]
> > > > > > Incremental.c: In function 'Incremental_container':
> > > > > > Incremental.c:1593:3: error: 'mdfd' may be used
> > > > > > uninitialized in this function [-Werror=maybe-
> > > > > > uninitialized]
> > > > > > close(mdfd);
> > > > > > ^~~~~~~~~~~
> > > > > 
> > > > > [snip]
> > > > > super-intel.c: In function 'apply_takeover_update':
> > > > > > super-intel.c:9615:15: error: '%d' directive writing
> > > > > > between 1 and 11 bytes into a region of size 7 [-
> > > > > > Werror=format-overflow=]
> > > > > > " MISSING_%d", du->index);
> > > > > > ^~
> > > > > ...
> > > > 
> > > > I am seeing these warnings only with -Og, are you also seeing
> > > > them with
> > > > -Og (DEBUG_OPTIMIZATION) only?
> > > > 
> > > > If this is true, I would consider
> > > > https://sources.debian.org/src/mdadm/4.1-2/debian/patches/debian-no-Werror.diff/
> > > > a better workaround.
> > > > 
> > > This seems a broader brush, I really dont like to relegate Werror
> > > if
> > > we dont have to, because it will force us
> > > to fix the code.
> > 
> > How are we getting such fixes properly reviewed?
> > 
> > What actually happens is that the easiest change that silences a
> > warning
> > gets applied.
> > 
> > And for such bogus -Og only warnings there was no problem in the
> > code,
> 
> so then probably a better fix is to add -Wno-error to DEBUG_FLAGS
> which will limit it to -Og case, and revert the original fix.
> 
> 
> 
> > meaning regression risks by OE/Yocto-only patches without fixing
> > anything.
> > 
> > > However, I am seeing it fail with clang now
> > > 
> > > https://errors.yoctoproject.org/Errors/Details/233618/
> > 
> > This is caused by the "fix" for the -Og gcc warning.
> > 
> > Which looks bogus, and might be harmful.
> 
> I think that is right. the fix seems to be regressing on gcc 9 as
> well so it has to be done differently.

Agreed, we should revert it, its creating more problems than it solves.

Cheers,

Richard




More information about the Openembedded-core mailing list