Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-12 Thread Joe Perches
On Mon, 2020-10-12 at 16:21 +0200, Borislav Petkov wrote: > On Sat, Oct 10, 2020 at 09:47:59AM -0700, Joe Perches wrote: > > > '/\s*\.byte\s+(?:0x[0-9a-f]{1,2}[\s,]*){2,}/i' > > ^^^ ^ > > now useless without the " > > There are \.byte specifications

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-12 Thread Borislav Petkov
On Sat, Oct 10, 2020 at 09:47:59AM -0700, Joe Perches wrote: > > '/\s*\.byte\s+(?:0x[0-9a-f]{1,2}[\s,]*){2,}/i' > ^^^ ^ > now useless without the " There are \.byte specifications without " so not useless. > matches .BYTE so what. It would have failed

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-10 Thread Joe Perches
On Sat, 2020-10-10 at 18:11 +0200, Borislav Petkov wrote: > On Sat, Oct 10, 2020 at 08:27:20AM -0700, Joe Perches wrote: > > Then this could use: > > > > /"\s*\.byte\s+(?:0x[0-9a-fA-F]{1,2}\s*,\s*){2,4}/ > > Yes, this is getting close. > > I've tweaked it a bit to: > >

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-10 Thread Joe Perches
On Sat, 2020-10-10 at 12:54 +0200, Borislav Petkov wrote: > > checkpatch uses only a single line output only before $herecurr > > Output line length doesn't matter. [] > WARNING: Please document which binutils version supports these .byte-spelled > insn opcodes by adding "binutils version

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-10 Thread Borislav Petkov
On Sat, Oct 10, 2020 at 08:27:20AM -0700, Joe Perches wrote: > Then this could use: > > /"\s*\.byte\s+(?:0x[0-9a-fA-F]{1,2}\s*,\s*){2,4}/ Yes, this is getting close. I've tweaked it a bit to: '/\s*\.byte\s+(?:0x[0-9a-f]{1,2}[\s,]*){2,}/i' which assumes at least 2 opcode bytes; upper limit can

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-10 Thread Borislav Petkov
On Fri, Oct 09, 2020 at 11:01:18AM -0700, Joe Perches wrote: > Given the location, this only works on .c and .h files. > It does not work on .S files. Should it? Probably not because there will be too many false positives. .byte is used not only to spell instruction opcodes in .S files. And the

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-10 Thread Joe Perches
On Sat, 2020-10-10 at 12:54 +0200, Borislav Petkov wrote: > On Fri, Oct 09, 2020 at 11:01:18AM -0700, Joe Perches wrote: > > Given the location, this only works on .c and .h files. > > It does not work on .S files. Should it? > > Probably not because there will be too many false positives. .byte

Re: [PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-09 Thread Joe Perches
On Fri, 2020-10-09 at 18:14 +0200, Borislav Petkov wrote: > From: Borislav Petkov > > Instruction opcode bytes spelled using the gas directive .byte should > carry a comment above them stating which binutils version has added > support for the instruction mnemonic so that they can be replaced

[PATCH] checkpatch: Check for .byte-spelled insn opcodes documentation on x86

2020-10-09 Thread Borislav Petkov
From: Borislav Petkov Instruction opcode bytes spelled using the gas directive .byte should carry a comment above them stating which binutils version has added support for the instruction mnemonic so that they can be replaced with the mnemonic when that binutils version is equal or less than the