* re: PM / devfreq: map devfreq drivers to governor using name
@ 2020-10-28 12:00 Colin Ian King
2020-10-28 12:04 ` Colin Ian King
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2020-10-28 12:00 UTC (permalink / raw)
To: Nishanth Menon
Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Krzysztof Kozlowski,
Linux PM, linux-kernel, linux-arm-kernel, linux-samsung-soc
Hi,
Static analysis of linux-next with Coverity has found a potential null
pointer dereference issue with the following commit:
commit 1b5c1be2c88e8445a20fa1929e26c37e7ca8c926
Author: Nishanth Menon <nm@ti.com>
Date: Mon Oct 29 15:01:45 2012 -0500
PM / devfreq: map devfreq drivers to governor using name
The analysis is as follows for devfreq_remove_governor in
drivers/devfreq/devfreq.c
1312
deref_ptr_in_call: Dereferencing pointer devfreq->governor.
1313 if (!strncmp(devfreq->governor->name, governor->name,
1314 DEVFREQ_NAME_LEN)) {
1315 /* we should have a devfreq governor! */
Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking devfreq->governor suggests that it may
be null, but it has already been dereferenced on all paths leading to
the check.
1316 if (!devfreq->governor) {
1317 dev_warn(dev, "%s: Governor %s NOT
present\n",
1318 __func__, governor->name);
1319 continue;
1320 /* Fall through */
So devfreq->governor->name is dereferencing devfreq->governor before a
null check on devfreq->governor
Colin
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PM / devfreq: map devfreq drivers to governor using name
2020-10-28 12:00 PM / devfreq: map devfreq drivers to governor using name Colin Ian King
@ 2020-10-28 12:04 ` Colin Ian King
0 siblings, 0 replies; 2+ messages in thread
From: Colin Ian King @ 2020-10-28 12:04 UTC (permalink / raw)
To: Nishanth Menon
Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Krzysztof Kozlowski,
Linux PM, linux-kernel, linux-arm-kernel, linux-samsung-soc
On 28/10/2020 12:00, Colin Ian King wrote:
> Hi,
>
> Static analysis of linux-next with Coverity has found a potential null
> pointer dereference issue with the following commit:
>
> commit 1b5c1be2c88e8445a20fa1929e26c37e7ca8c926
> Author: Nishanth Menon <nm@ti.com>
> Date: Mon Oct 29 15:01:45 2012 -0500
>
> PM / devfreq: map devfreq drivers to governor using name
>
>
> The analysis is as follows for devfreq_remove_governor in
> drivers/devfreq/devfreq.c
>
> 1312
>
> deref_ptr_in_call: Dereferencing pointer devfreq->governor.
>
> 1313 if (!strncmp(devfreq->governor->name, governor->name,
> 1314 DEVFREQ_NAME_LEN)) {
> 1315 /* we should have a devfreq governor! */
>
> Dereference before null check (REVERSE_INULL)
> check_after_deref: Null-checking devfreq->governor suggests that it may
> be null, but it has already been dereferenced on all paths leading to
> the check.
>
> 1316 if (!devfreq->governor) {
> 1317 dev_warn(dev, "%s: Governor %s NOT
> present\n",
> 1318 __func__, governor->name);
> 1319 continue;
> 1320 /* Fall through */
>
> So devfreq->governor->name is dereferencing devfreq->governor before a
> null check on devfreq->governor
>
> Colin
>
I forgot to mention, an identical issue also exists here:
1247 list_for_each_entry(devfreq, &devfreq_list, node) {
1248 int ret = 0;
1249 struct device *dev = devfreq->dev.parent;
1250
deref_ptr_in_call: Dereferencing pointer devfreq->governor.
1251 if (!strncmp(devfreq->governor->name, governor->name,
1252 DEVFREQ_NAME_LEN)) {
1253 /* The following should never occur */
Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking devfreq->governor suggests that it may
be null, but it has already been dereferenced on all paths leading to
the check.
1254 if (devfreq->governor) {
1255 dev_warn(dev,
1256 "%s: Governor %s already
present\n",
1257 __func__,
devfreq->governor->name);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-28 23:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 12:00 PM / devfreq: map devfreq drivers to governor using name Colin Ian King
2020-10-28 12:04 ` Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).