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]
Message-ID: <51ca818443648cb25a604448dea022d6ac2ea09f.camel@perches.com>
Date:   Wed, 24 Jun 2020 22:50:56 -0700
From:   Joe Perches <joe@...ches.com>
To:     Kees Cook <keescook@...omium.org>,
        Aiden Leong <aiden.leong@...sd.com>
Cc:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ferdinand Blomqvist <ferdinand.blomqvist@...il.com>,
        YueHaibing <yuehaibing@...wei.com>, dm-devel@...hat.com,
        linux-kernel@...r.kernel.org, Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...hat.com>,
        Anton Vorontsov <anton@...msg.org>,
        Colin Cross <ccross@...roid.com>,
        Tony Luck <tony.luck@...el.com>
Subject: Re: [RFC] Reed-Solomon Code: Update no_eras to the actual number of
 errors

On Wed, 2020-06-24 at 22:35 -0700, Kees Cook wrote:
> On Wed, Jun 24, 2020 at 09:10:53PM -0700, Aiden Leong wrote:
> > Corr and eras_pos are updated to actual correction pattern and erasure
> > positions, but no_eras is not.
[]
> > @@ -312,14 +313,21 @@
> >  				eras_pos[j++] = loc[i] - pad;
> >  			}
> >  		}
> > +		if (no_eras > 0)
> > +			*no_eras = j;
> 
> Is this meant to be "if (j > 0)" or "if (no_eras != NULL)" ? It's
> uncommon to use > 0 for a pointer value.
> 
> >  	} else if (data && par) {
> >  		/* Apply error to data and parity */
> > +		j = 0;
> >  		for (i = 0; i < count; i++) {
> >  			if (loc[i] < (nn - nroots))
> >  				data[loc[i] - pad] ^= b[i];
> >  			else
> >  				par[loc[i] - pad - len] ^= b[i];
> > +			if (b[i])
> > +				j++;
> >  		}
> > +		if (no_eras > 0)
> > +			*no_eras = j;
> 
> I assume it's a pointer test, so both would be:
> 
> 		if (no_eras_ptr != NULL)
> 			*no_eras_ptr = j;

More common still would be

		if (no_eras_ptr)
			*no_eras_ptr = j;

though I think using _ptr is too Hungarian.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ