* [bug report] of: base: Introduce of_alias_get_alias_list() to check alias IDs
@ 2022-03-15 15:09 Dan Carpenter
2022-03-21 16:33 ` Rob Herring
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2022-03-15 15:09 UTC (permalink / raw)
To: michal.simek; +Cc: devicetree
Hello Michal Simek,
The patch b1078c355d76: "of: base: Introduce
of_alias_get_alias_list() to check alias IDs" from Sep 20, 2018,
leads to the following Smatch static checker warning:
drivers/of/base.c:2038 of_alias_get_alias_list()
warn: passing negative bit value 's32min-(-2),0-s32max' to 'set_bit()'
drivers/of/base.c
2028 }
2029
2030 if (of_match_node(matches, app->np)) {
2031 pr_debug("%s: Allocated ID %d\n", __func__, app->id);
2032
2033 if (app->id >= nbits) {
2034 pr_warn("%s: ID %d >= than bitmap field %d\n",
2035 __func__, app->id, nbits);
2036 ret = -EOVERFLOW;
2037 } else {
--> 2038 set_bit(app->id, bitmap);
Yes, there is a possibility for passing negative bits to set_bit().
But don't these bounds checks really belong in of_alias_add()? Adding
invalid aliases seems like a risky thing.
2039 }
2040 }
2041 }
2042 mutex_unlock(&of_mutex);
2043
2044 return ret;
2045 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] of: base: Introduce of_alias_get_alias_list() to check alias IDs
2022-03-15 15:09 [bug report] of: base: Introduce of_alias_get_alias_list() to check alias IDs Dan Carpenter
@ 2022-03-21 16:33 ` Rob Herring
2022-03-21 16:38 ` Michal Simek
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2022-03-21 16:33 UTC (permalink / raw)
To: Dan Carpenter, Michal Simek; +Cc: devicetree
On Tue, Mar 15, 2022 at 10:09 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hello Michal Simek,
>
> The patch b1078c355d76: "of: base: Introduce
> of_alias_get_alias_list() to check alias IDs" from Sep 20, 2018,
> leads to the following Smatch static checker warning:
>
> drivers/of/base.c:2038 of_alias_get_alias_list()
> warn: passing negative bit value 's32min-(-2),0-s32max' to 'set_bit()'
The 1 user of of_alias_get_alias_list() has since been refactored and
doesn't use of_alias_get_alias_list() anymore. So I'm just going to
revert b1078c355d76.
Rob
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] of: base: Introduce of_alias_get_alias_list() to check alias IDs
2022-03-21 16:33 ` Rob Herring
@ 2022-03-21 16:38 ` Michal Simek
0 siblings, 0 replies; 3+ messages in thread
From: Michal Simek @ 2022-03-21 16:38 UTC (permalink / raw)
To: Rob Herring, Dan Carpenter, Michal Simek; +Cc: devicetree
On 3/21/22 17:33, Rob Herring wrote:
> On Tue, Mar 15, 2022 at 10:09 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>
>> Hello Michal Simek,
>>
>> The patch b1078c355d76: "of: base: Introduce
>> of_alias_get_alias_list() to check alias IDs" from Sep 20, 2018,
>> leads to the following Smatch static checker warning:
>>
>> drivers/of/base.c:2038 of_alias_get_alias_list()
>> warn: passing negative bit value 's32min-(-2),0-s32max' to 'set_bit()'
>
> The 1 user of of_alias_get_alias_list() has since been refactored and
> doesn't use of_alias_get_alias_list() anymore. So I'm just going to
> revert b1078c355d76.
yes. I am fine with it. We can get it back and fix it when it is again needed.
Thanks,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-21 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-15 15:09 [bug report] of: base: Introduce of_alias_get_alias_list() to check alias IDs Dan Carpenter
2022-03-21 16:33 ` Rob Herring
2022-03-21 16:38 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox