Re: [PATCH 07/21] libmultipath: use strbuf in parse_vpd_pg83()

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

 



On Tue, 2021-11-30 at 14:29 -0600, Benjamin Marzinski wrote:
> On Tue, Nov 30, 2021 at 12:26:47PM +0100, Martin Wilck wrote:
> > On Mon, 2021-11-29 at 19:18 -0600, Benjamin Marzinski wrote:
> > > On Fri, Nov 19, 2021 at 12:13:24AM +0100, mwilck@xxxxxxxx wrote:
> > > > -               out[0] = '1';
> > > > -               len = 1;
> > > > -               while ((p = memchr(vpd, ' ', vpd_len))) {
> > > > +               if ((err = fill_strbuf(&buf, '1', 1)) < 0)
> > > > +                       return err;
> > > > +               while (vpd && (p = memchr(vpd, ' ', vpd_len)))
> > > > {
> > > 
> > > vpd should never be zero here unless it wraps around, which seems
> > > very
> > > unlikely.  Is this just to make coverity happy, or do you mean
> > > (*vpd)?
> > > 
> > 
> > Coverity likes arguments for memchr() to be NULL-checked
> > beforehand, 
> > but that wasn't the main reason.
> > 
> > See below, there's "vpd = p". And p can (and will sooner or later)
> > be
> > NULL, because memchr() returns NULL if it doesn't find anything.
> > 
> 
> Right, but don't you only execute this while loop if p isn't NULL?
> Not
> that it really matters. I'm fine with the code that way it is.

Ah, I misinterpreted your comment. This one was for coverity, IIRC;
to make it believe that it's legal to take *vpd.

Martin


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux