3 ms·
I don't think this code needed to be unsafe. This code doesn't involve any I/O or kernel pointer/CPU register management; it's just modifying a list. I'm sure
by jeroenhd 11mo ago
I don't think this code needed to be unsafe. This code doesn't involve any I/O or kernel pointer/CPU register management; it's just modifying a list.
I'm sure the people who wrote this code had their reasons to write the code like this (probably simplicity or performance), but this type of kernel code could be done safely.
- aw1621107 11mo agoAs pointed out by yuriks [0], it seems the patch authors are interested in looking into a safer solution [1]: > The previous patches in this series illustrate why the List::remove method is really dangerous. I think the real takeaway here is to replace the linked lists with a different data structure without this unsafe footgun, but for now we fix the bugs and add a warning to the docs. [0]: https://news.ycombinator.com/item?id=46307357 https://news.ycombinator.com/item?id=46307357 [1]: https://news.ycombinator.com/item?id=46307357 https://news.ycombinator.com/item?id=46307357