From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@chromium.org>, Aiden Leong <aiden.leong@aibsd.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ferdinand Blomqvist <ferdinand.blomqvist@gmail.com>,
YueHaibing <yuehaibing@huawei.com>,
dm-devel@redhat.com, linux-kernel@vger.kernel.org,
Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>
Subject: Re: [RFC] Reed-Solomon Code: Update no_eras to the actual number of errors
Date: Wed, 24 Jun 2020 22:50:56 -0700 [thread overview]
Message-ID: <51ca818443648cb25a604448dea022d6ac2ea09f.camel@perches.com> (raw)
In-Reply-To: <202006242231.E17DAB2@keescook>
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.
next prev parent reply other threads:[~2020-06-25 5:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 4:10 Aiden Leong
2020-06-25 5:35 ` Kees Cook
2020-06-25 5:50 ` Joe Perches [this message]
[not found] ` <5f4008d5-1ddd-443e-9190-a8565746698d.aiden.leong@aibsd.com>
2020-06-25 13:15 ` Ferdinand Blomqvist
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51ca818443648cb25a604448dea022d6ac2ea09f.camel@perches.com \
--to=joe@perches.com \
--cc=agk@redhat.com \
--cc=aiden.leong@aibsd.com \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=dm-devel@redhat.com \
--cc=ferdinand.blomqvist@gmail.com \
--cc=gustavo@embeddedor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®