-
Notifications
You must be signed in to change notification settings - Fork 5.1k
object.c 中 rt_object_find 的修改存在 bug #8960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Cannot re-produce on #8959 |
建议先检查你的工程中是否存在栈溢出问题。 |
并不是。是判断 name 是否匹配,然后被更新。 |
补充的那个场景在 utest 复现了。 定位了一下,是因为一开始没考虑到 &object->name == object 的情况。 |
原本的意思是复用一个地址来存参数 name 和匹配对象 obj。如果假定两个对象地址不会重名,那么这个地址被更新就说明匹配成功。不过之前没考虑到 rt_object 的 name 也放在 obj 起始地址上,所以 name 和 obj 两个指针有可能相同的情况。 |
顺便吐槽一下,拿到 object 还要用 object->parent->name 去找设备,这使用场景真的有点怪 😂 |
可以了 |
第一,rt_object_for_each 有实际引用的,对应于场景{匹配所有符合某种模式的设备,如 |
object.c 中 rt_object_find 的修改存在 bug.
成功 , 但如果改用以下代码
则会失败
Originally posted by @liuyangzys in #8949 (comment)
The text was updated successfully, but these errors were encountered: