Thread (11 messages) 11 messages, 3 authors, 12d ago

Re: [PATCH v2 6/6] serial: 8250: make port operations work on struct uart_8250_port

flat view

From: Alejandro Colomar <alx+linux-hardening@kernel.org>
Date: 2026-10-13 10:54:47
Also in: linux-arm-kernel, linux-aspeed, linux-hardening, linux-mediatek, linux-mips, linux-serial, linux-tegra

Hi Jiri,
Date: 2026-10-13 12:15:35+0200
From: Jiri Slaby <jirislaby@kernel.org>

On 13. 10. 26, 12:00, Andy Shevchenko wrote:
quoted
quoted
quoted
quoted
First, it is used in the kernel quite a few times already
[1]. Second, while it is sort of c++ism (and I like to use modern c++), it
makes the life of the variable a lot more obvious.

[1] eg. see output of: rg -U -C 5 '}\n+\s+struct .*\*.*=' drivers/
(you made me to install something I haven't heard about, it's better to use
   `git grep` though)
rg is order of magnitude faster (searches in parallel). More importantly in
this case, supports multiline matches. (And respects .git ignores.)
Isn't `git grep` fast enough due to looking into index and not into the files?
`rg` may not look at the Git index, right? So I may not to use an arbitrary
hash without checking it out first.
Of course rg is not git grep.
quoted
quoted
quoted
Note excluded __free() if I get regexp correctly

$ rg -U -l '}\n+\s+struct .*\*[^)]*=' drivers/ | less
drivers/ufs/host/ufs-qcom.c
...
quoted
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

So, less than dozen of drivers doing wrong is not an argument, try something
better. But thanks, I will check and address this in some of the above.
Well, it's only an example of a declaration after a previous opening brace
"{" -- this one turned out to be easy to search for. There is a lot of more,
of course. kernel/ included.
Please, provide a better search line, I will look at that. For now it's just
a hypothetical assumption, I am afraid.
I am not much into writing a semi-parser at this point :D. This'd be a task
eg. for clang's ASTMatcher.
You may check grepc(1) --provided in man-pages.git--, which does have
some code for searching different kinds of code.  You may need to tweak
some regex produced by the backend grepc_c(1), but it should be
possible.


Cheers,
Alex
thanks,
-- 
js
suse labs
-- 
<https://www.alejandro-colomar.es>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help