Messages in this thread | | | Date | Wed, 2 Jun 2021 12:37:32 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH] x86/alternative: Optimize single-byte NOPs at an arbitrary position |
| |
On Wed, Jun 02, 2021 at 10:14:58AM +0200, Peter Zijlstra wrote: > Who again insisted that wouldn't happen? :-)
Yours truly, ofc. :-P
> That's almost a proper comment, might as well finish it > > /* > * optimize_nops_range() - Optimize a sequence of single byte NOPs (0x90) > * @instr: instruction byte stream > * @instrlen: length of the above > * @off: offset within @instr where the first NOP has been detected > * > * Return: number of NOPs found (and replaced) > */
Done.
> for (; i < instrlen && instr[i] == 0x90; i++) > ; > > perhaps? (possibly too dense, up to you)
Yeah, let's leave it simple so that one can read it at a quick glance.
> > + > > + nnops = i - off; > > + > > + if (nnops <= 1) > > + return nnops; > > !nnops would be an error, no?
Yeah, just being overly cautious. It should not be 0 since we're being called for the byte at offset being 0x90. But I have said "should not be" before and have fallen flat on my face.
> We really needs that extra line?
Zapped.
> Anyway, irrespective of nits: > > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Thanks, all except one incorporated.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |