lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 20 Nov 2020 11:47:15 +0100 (CET) From: Julia Lawall <julia.lawall@...ia.fr> To: Joe Perches <joe@...ches.com> cc: Andy Shevchenko <andy.shevchenko@...il.com>, Alexandru Ardelean <ardeleanalex@...il.com>, Robo Bot <apw@...onical.com>, Alexandru Ardelean <alexandru.ardelean@...log.com>, LKML <linux-kernel@...r.kernel.org>, cocci <cocci@...teme.lip6.fr> Subject: Re: [Cocci] Proposal for a new checkpatch check; matching _set_drvdata() & _get_drvdata() On Thu, 19 Nov 2020, Joe Perches wrote: > On Thu, 2020-11-19 at 17:16 +0200, Andy Shevchenko wrote: > > On Thu, Nov 19, 2020 at 4:09 PM Alexandru Ardelean > > <ardeleanalex@...il.com> wrote: > > > > > > Hey, > > > > > > So, I stumbled on a new check that could be added to checkpatch. > > > Since it's in Perl, I'm reluctant to try it. > > > > > > Seems many drivers got to a point where they now call (let's say) > > > spi_set_drvdata(), but never access that information via > > > spi_get_drvdata(). > > > Reasons for this seem to be: > > > 1. They got converted to device-managed functions and there is no > > > longer a remove hook to require the _get_drvdata() access > > > 2. They look like they were copied from a driver that had a > > > _set_drvdata() and when the code got finalized, the _set_drvdata() was > > > omitted > > > > > > There are a few false positives that I can notice at a quick look, > > > like the data being set via some xxx_set_drvdata() and retrieved via a > > > dev_get_drvdata(). > > > > I can say quite a few. And this makes a difference. > > So, basically all drivers that are using PM callbacks would rather use > > dev_get_drvdata() rather than bus specific. > > > > > I think checkpatch reporting these as well would be acceptable simply > > > from a reviewability perspective. > > > > > > I did a shell script to quickly check these. See below. > > > It's pretty badly written but it is enough for me to gather a list. > > > And I wrote it in 5 minutes :P > > > I initially noticed this in some IIO drivers, and then I suspected > > > that this may be more widespread. > > > > It seems more suitable for coccinelle. > > To me as well. To me as well, since it seems to involve nonlocal information. I'm not sure to understand the original shell script. Is there something interesting about pci_set_drvdata? julia
Powered by blists - more mailing lists