)]}'
{"src/target/cortex_m.h":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"6e7eb1f024084ac479924439e28ca1583f320b13","unresolved":false,"context_lines":[{"line_number":251,"context_line":"target_to_cm(struct target *target)"},{"line_number":252,"context_line":"{"},{"line_number":253,"context_line":"\treturn container_of(target-\u003earch_info,"},{"line_number":254,"context_line":"\t\t\tstruct cortex_m_common, armv7m.arm);"},{"line_number":255,"context_line":"}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"static inline bool is_cortex_m_or_hla(const struct cortex_m_common *cortex_m)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"cd8ff451_009402ce","line":254,"updated":"2021-11-25 15:22:54.000000000","message":"The new implementation of container_of() in Linux kernel adds some extra test on types, but also that version fails to identify this error because target-\u003earch_info is a void * !\nI\u0027m considering taking that new code in openocd, but adding the extra test that the first argument should not be a void *!\n\nWe should make it explicit here what arch_info contains:\nstatic inline struct cortex_m_common *target_to_cm(struct target *target)\n{\n  struct arm *arm \u003d target-\u003earch_info;\n  return container_of(target-\u003earch_info, struct cortex_m_common, armv7m.arm);\n}\nand this will permit the type check. Of course, assuming we have used the proper types.","commit_id":"db3d5d4d12901341c044dedb59529b81068fcbb2"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"bcc51ae9c3dac1aeee928b49b71cac4ae4e23850","unresolved":false,"context_lines":[{"line_number":251,"context_line":"target_to_cm(struct target *target)"},{"line_number":252,"context_line":"{"},{"line_number":253,"context_line":"\treturn container_of(target-\u003earch_info,"},{"line_number":254,"context_line":"\t\t\tstruct cortex_m_common, armv7m.arm);"},{"line_number":255,"context_line":"}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"static inline bool is_cortex_m_or_hla(const struct cortex_m_common *cortex_m)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e71bc137_c2dca3e2","line":254,"in_reply_to":"1e32636c_0060c6b4","updated":"2021-11-25 15:54:44.000000000","message":"Yes, I meant \u0027arm\u0027! I\u0027m making too many mistakes, recently!\nAgree, a global rework would make much more sense, and this change detects error even with current implementation of container_of().\nI don\u0027t plan to take quickly the new linux container_of() because it uses GCC builtins and C11 extensions; the risk to break the build on some system is too high. Maybe after v0.12.0...","commit_id":"db3d5d4d12901341c044dedb59529b81068fcbb2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1c802f559ded1ce4ee301bfb651c2d1114fa26b6","unresolved":false,"context_lines":[{"line_number":251,"context_line":"target_to_cm(struct target *target)"},{"line_number":252,"context_line":"{"},{"line_number":253,"context_line":"\treturn container_of(target-\u003earch_info,"},{"line_number":254,"context_line":"\t\t\tstruct cortex_m_common, armv7m.arm);"},{"line_number":255,"context_line":"}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"static inline bool is_cortex_m_or_hla(const struct cortex_m_common *cortex_m)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"1e32636c_0060c6b4","line":254,"in_reply_to":"cd8ff451_009402ce","updated":"2021-11-25 15:49:02.000000000","message":"\u003e The new implementation of container_of() in Linux kernel adds some extra test on types...\n\nCool!\n\n\u003e We should make it explicit here what arch_info contains:\n\u003e static inline struct cortex_m_common *target_to_cm(struct target *target)\n\u003e {\n\u003e   struct arm *arm \u003d target-\u003earch_info;\n\u003e   return container_of(target-\u003earch_info, struct cortex_m_common, armv7m.arm);\n                        ^^^^^^^^^^^^^^^^^\n\nYou probably meant \u0027arm\u0027 here.\nMakes sense. We might even use target_to_arm(target) instead of explicit cast to variable.\nAll 18 uses of container_of in the current target code have target-\u003earch_info as the first parameter, so I see no point in changing it just here.\nI checked them all visually and all but this looked correct.","commit_id":"db3d5d4d12901341c044dedb59529b81068fcbb2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"dbbe57f7e6a73787b9c379ccf2cbd729c26ab0f5","unresolved":false,"context_lines":[{"line_number":251,"context_line":"target_to_cm(struct target *target)"},{"line_number":252,"context_line":"{"},{"line_number":253,"context_line":"\treturn container_of(target-\u003earch_info,"},{"line_number":254,"context_line":"\t\t\tstruct cortex_m_common, armv7m.arm);"},{"line_number":255,"context_line":"}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"static inline bool is_cortex_m_or_hla(const struct cortex_m_common *cortex_m)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"40785190_33c5eaa7","line":254,"in_reply_to":"e71bc137_c2dca3e2","updated":"2021-11-25 16:08:31.000000000","message":"\u003e I\u0027m making too many mistakes, recently!\n\nMe too. We might need some rest...\n\n\u003e Maybe after v0.12.0...\n\nOMG :)","commit_id":"db3d5d4d12901341c044dedb59529b81068fcbb2"}]}
