Messages in this thread | | | Date | Sat, 7 Apr 2018 09:33:01 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH v4 4/9] vsprintf: Consolidate handling of unknown pointer specifiers |
| |
Hi Joe,
On (04/06/18 16:59), Joe Perches wrote: > > > > Can we tweak checkpatch to catch such things? > > Not really, no. > > Adding regex logic for this is tricky at best > and probably not worth the effort because of > the various bits of patch contexts aren't > necessarily visible.
Agreed. I was more thinking about catching "... %p" and saying that we'd rather prefer either "... %p," or "... %p " or "... %p\n". Doesn't sound so complex, can probably catch something fishy one day (or may be not), and more or less is visible to checkpatch. Well, more or less...
> There are also concatenations like > "foo" DEFINE "bar" > where DEFINE may not be visible in the patch > context and checkpatch is and likely will > remain just a limited regex checker.
Right. One example might be XFS
alert("%s: Bad regular inode %Lu, ptr "PTR_FMT, __func__, ip->i_ino, ip);
where PTR_FMT is
#ifdef DEBUG # define PTR_FMT "%px" #else # define PTR_FMT "%p" #endif
-ss
| |