[dm-devel] [PATCH v2 1/5] multipath: fix issues found by compiling with gcc 10

Benjamin Marzinski bmarzins at redhat.com
Thu Dec 3 20:52:03 UTC 2020


On Wed, Dec 02, 2020 at 01:54:57PM +0000, Martin Wilck wrote:
> Hi Ben,
> 
> On Wed, 2020-02-19 at 14:21 -0600, Benjamin Marzinski wrote:
> > Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> > ---
> >  kpartx/dasd.c        |  6 +++---
> >  libmultipath/print.c | 16 ++++++++--------
> >  multipath/main.c     |  2 +-
> >  3 files changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/kpartx/dasd.c b/kpartx/dasd.c
> > index 1486ccaa..14b9d3aa 100644
> > --- a/kpartx/dasd.c
> > +++ b/kpartx/dasd.c
> > @@ -186,7 +186,7 @@ read_dasd_pt(int fd, __attribute__((unused))
> > struct slice all,
> >  		goto out;
> >  	}
> >  
> > -	if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD")))
> > +	if ((!info.FBA_layout) && (!memcmp(info.type, "ECKD", 4)))
> >  		memcpy (&vlabel, data, sizeof(vlabel));
> >  	else {
> >  		bzero(&vlabel,4);
> 
> are you using different compiler / warning flags here than we usually do?

When building rhel and fedora packages, there are some flags that differ
from the upstream set.  Unfortunately, when I just tried rebuilding the
package with these fixes removed, I didn't hit any compiler errors.
Perhaps I just noticed these while working on something else, and they
got included in this commit on accident. Sadly I don't remember the
details anymore.

-Ben
> 
> I just found that with the standard flags, gcc 10 does *not* complain about
> the old (badly broken, noting that info.type is declared as char[4]) code.
> Nor has any other compiler so far, although we're using pretty verbose 
> warning options.
> 
> Regards
> Martin
> 
> -- 
> Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
> SUSE  Software Solutions Germany GmbH
> HRB 36809, AG Nürnberg GF: Felix
> Imendörffer
> 




More information about the dm-devel mailing list