)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"c92059db897d0cd17674da63bf95fc5fbb386295","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"7ae9017e_401dd158","updated":"2021-08-24 10:27:40.000000000","message":"the warnings are highlighted here:\nhttps://build.openocd.org/job/openocd-clang/1030/clang/fileName.-1000147774/","commit_id":"e703669aa81018ffae556a03401f61528111fd3f"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"b1ed43d061d56d62e7a3c0b48b73dfe59cc57636","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"684fbf50_a16c41e9","updated":"2021-09-06 13:59:50.000000000","message":"if you are happy with this change as-is, you can merge it befaore waiting for it\u0027s predecessors in the serie.","commit_id":"589295f668eed00206140c9462d09d648136508e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"383ec15d31706020b4b1e16a9722280babb685ce","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"d161bc8e_0f530059","updated":"2021-09-17 12:25:35.000000000","message":"Looks good, just a cosmetic nit:","commit_id":"461f432e03c597000383a2146aeb21fa28eb293b"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"264fc03c5144401846926d7fe1a29e31f919cd86","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"33f5d714_8c5479b3","updated":"2021-09-16 14:17:43.000000000","message":"rebased on top of master to break the relation chain with another ongoign patch","commit_id":"461f432e03c597000383a2146aeb21fa28eb293b"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"fff195af00220c2716e8d2e77b7468a9d69d8e56","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"88862643_126d737e","in_reply_to":"d161bc8e_0f530059","updated":"2021-09-20 15:25:28.000000000","message":"\u003e Looks good, just a cosmetic nit:\n\nThanks Tomas, I hope it\u0027s all good ;)","commit_id":"461f432e03c597000383a2146aeb21fa28eb293b"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"a40c7ddc2e3186598ff15665efb197a91c498fab","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"6a25fbbc_7049c44d","updated":"2021-11-05 21:37:32.000000000","message":"I like Antonio\u0027s proposal as it get rid of recursion.","commit_id":"9ee9975402737449b08e471c79f488d22f960fd0"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"d47c2389751a7c1ab1725cb45c10c6a16abeaa0d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"e7f3d235_eb503804","updated":"2021-09-21 10:14:28.000000000","message":"after detected the incorrect fix on 6565, I checked again this\nHere scan-build get mad with the recursive call in stm32l4_protect()\nIt\u0027s clearly a scan-build issue, a false positive\nMaybe a better fix (better than assert) could be to refactor stm32l4_protect() to avoid recursive calls. Something like (not tested):\nstm32l4_protect(,,first,last)\n{\nif (last \u003c stm32l4_info-\u003ebank1_sectors) {\nstm32l4_protect_same_bank(,,first,last,STM32_BANK1);\n} else if (first \u003e\u003d stm32l4_info-\u003ebank1_sectors) {\nstm32l4_protect_same_bank(,,first,last,STM32_BANK2);\n} else {\nstm32l4_protect_same_bank(,,first,stm32l4_info-\u003ebank1_sectors-1,STM32_BANK1);\nstm32l4_protect_same_bank(,,stm32l4_info-\u003ebank1_sectors,last,STM32_BANK2);\n}","commit_id":"9ee9975402737449b08e471c79f488d22f960fd0"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"a40c7ddc2e3186598ff15665efb197a91c498fab","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"e9a86682_3aa41905","in_reply_to":"b420edae_0888f764","updated":"2021-11-05 21:37:32.000000000","message":"I like Antonio\u0027s proposal as it get rid of recursion.","commit_id":"9ee9975402737449b08e471c79f488d22f960fd0"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"a719a5dded84b008633a340eac4c2c83211d4019","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"b420edae_0888f764","in_reply_to":"e7f3d235_eb503804","updated":"2021-09-21 16:15:45.000000000","message":"I Know, that\u0027s a false positive, please check my analysis in my comment of Aug 25 12:22 PM.\n\nI prefer a simple fix to silence scan-build instead of refactoring and retesting on real HW.","commit_id":"9ee9975402737449b08e471c79f488d22f960fd0"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b47d0a7bb493a06c3bcf67a85798a18124d41f85","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"56b21556_4695c921","updated":"2022-05-26 16:49:00.000000000","message":"thanks","commit_id":"cc9220fece9f7a434da0c8a914efd466a0e72f17"}],"src/flash/nor/stm32l4x.c":[{"author":{"_account_id":1000160,"name":"Paul Fertser","email":"fercerpav@gmail.com","username":"pfertser"},"change_message_id":"c655888fbe17fd305adaee6f9e93958da27069e2","unresolved":false,"context_lines":[{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"\t/* use bitmap and range helpers to optimize the WRP usage */"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"\t/* this should never happen, silence a scan-build warning */"},{"line_number":1081,"context_line":"\tif (!bank-\u003enum_sectors)"},{"line_number":1082,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1083,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"68b71089_d5ef8aeb","line":1080,"updated":"2021-08-24 11:45:48.000000000","message":"I\u0027m not sure I understand the reasoning. The clang reports shows full execution path of how exactly this can happen. Have you found it to be wrong in some specific detail of it?","commit_id":"e703669aa81018ffae556a03401f61528111fd3f"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"eb77b25400aeec24f38ae74af1a67d21678a5379","unresolved":false,"context_lines":[{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"\t/* use bitmap and range helpers to optimize the WRP usage */"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"\t/* this should never happen, silence a scan-build warning */"},{"line_number":1081,"context_line":"\tif (!bank-\u003enum_sectors)"},{"line_number":1082,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1083,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"277950ff_11d85b15","line":1080,"in_reply_to":"68b71089_d5ef8aeb","updated":"2021-08-25 11:22:14.000000000","message":"the full path here is just \"crap\", clang analysis shows how the execution arrived here.\n\nMy arguments are based on:\n a. where num_sectors is set ?\n b. who call this functions ?\n\nlet starts with b.: \nstm32l4_protect is registered as flash_driver::protect which is called by\n\nflash_driver::protect\n|- flash_driver_protect\n|  |- virtual_protect (same as calling flash_driver_protect)\n|  |- handle_flash_protect_command [1]\n|  |- flash_driver_unprotect\n|     |- flash_unlock_address_range\n|        |- flash_write_unlock_verify [2]\n|        |  |- handle_flash_write_image_command\n|        |  |- handle_flash_verify_image_command\n|        |  |- flash_write ...\n|        |- handle_flash_erase_address_command [3]\n\n\n[1] call flash_command_get_bank which enforces probing\n[2] and [3] calls get_flash_bank_by_addr before calling [...] flash_driver.protect\n    get_flash_bank_by_addr enforces the probing of the corresponding bank\n\nconclusion all callchains requires the good execution of flash_driver::probe\naka stm32l4x_probe\n\na. stm32l4x_probe is the only function that sets num_sectors in this driver.\nnum_sectors is set to num_pages, num_pages should never be zero since flash_size_kb is always a multple of page_size_kb\n\nConclusion: the analysis of clan here is just crap.\nBut: doing th full analysis visually, there is risk if the user forces the flash_size manually which is a possibility that I have ignored.\n\nI will update the probe with a check on the flash size enterd by the user.","commit_id":"e703669aa81018ffae556a03401f61528111fd3f"},{"author":{"_account_id":1000160,"name":"Paul Fertser","email":"fercerpav@gmail.com","username":"pfertser"},"change_message_id":"c655888fbe17fd305adaee6f9e93958da27069e2","unresolved":false,"context_lines":[{"line_number":1925,"context_line":"\tstruct stm32l4_wrp wrpxy[4];"},{"line_number":1926,"context_line":""},{"line_number":1927,"context_line":"\tret \u003d stm32l4_get_all_wrpxy(bank, dev_bank_id, wrpxy, \u0026n_wrp);"},{"line_number":1928,"context_line":"\tret \u003d n_wrp ? ret : ERROR_FAIL;"},{"line_number":1929,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":1930,"context_line":"\t\treturn ret;"},{"line_number":1931,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"ef6daee5_f17ae54f","line":1928,"updated":"2021-08-24 11:45:48.000000000","message":"Same question here. If we arrived here calling all_wrpxy and it returned zero n_wrp then probably it\u0027s some earlier problem that could have been detected long before?","commit_id":"e703669aa81018ffae556a03401f61528111fd3f"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"79f61d2f779a62f47494da366db533f6a7eae726","unresolved":false,"context_lines":[{"line_number":1925,"context_line":"\tstruct stm32l4_wrp wrpxy[4];"},{"line_number":1926,"context_line":""},{"line_number":1927,"context_line":"\tret \u003d stm32l4_get_all_wrpxy(bank, dev_bank_id, wrpxy, \u0026n_wrp);"},{"line_number":1928,"context_line":"\tret \u003d n_wrp ? ret : ERROR_FAIL;"},{"line_number":1929,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":1930,"context_line":"\t\treturn ret;"},{"line_number":1931,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e2675936_bc5cf5a0","line":1928,"in_reply_to":"ef6daee5_f17ae54f","updated":"2021-08-25 10:19:12.000000000","message":"let\u0027s consider this case, the critical point is the result of get_all_wrpxy\naccording to https://build.openocd.org/job/openocd-clang/scan-build_20Report/report-79201a.html#Path22\n\nstep 23 is false, and step 24 is true, this means bank_id \u003d BANK2\nanyway in step 24 wrp2y_sectors_offset is set to stm32l4_info-\u003ebank1_sectors\nand bank1_sectors is \u003e\u003d 0, otherwise the probe function have failed before that.\n\nhence: in line 1893 we are ensuring that probe function exited with ERROR_OK thus bank1_sectors is equal to page numbers (the worst case should be zero, ans this should never happen as well)","commit_id":"e703669aa81018ffae556a03401f61528111fd3f"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"383ec15d31706020b4b1e16a9722280babb685ce","unresolved":true,"context_lines":[{"line_number":1075,"context_line":"\t\t\twrp2y_sectors_offset \u003d 0;"},{"line_number":1076,"context_line":"\t}"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"\t/* if bank_id is BANK2 or ALL_BANKS */"},{"line_number":1079,"context_line":"\tassert(stm32l4_info-\u003ebank1_sectors \u003e 0);"},{"line_number":1080,"context_line":"\tif (dev_bank_id !\u003d STM32_BANK1 \u0026\u0026 stm32l4_info-\u003edual_bank_mode)"},{"line_number":1081,"context_line":"\t\twrp2y_sectors_offset \u003d stm32l4_info-\u003ebank1_sectors;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"197a6ad5_fb5b31a8","line":1078,"range":{"start_line":1078,"start_character":1,"end_line":1078,"end_character":39},"updated":"2021-09-17 12:25:35.000000000","message":"This comment explains the condition on line 1080, please move assert before","commit_id":"589295f668eed00206140c9462d09d648136508e"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"fff195af00220c2716e8d2e77b7468a9d69d8e56","unresolved":false,"context_lines":[{"line_number":1075,"context_line":"\t\t\twrp2y_sectors_offset \u003d 0;"},{"line_number":1076,"context_line":"\t}"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"\t/* if bank_id is BANK2 or ALL_BANKS */"},{"line_number":1079,"context_line":"\tassert(stm32l4_info-\u003ebank1_sectors \u003e 0);"},{"line_number":1080,"context_line":"\tif (dev_bank_id !\u003d STM32_BANK1 \u0026\u0026 stm32l4_info-\u003edual_bank_mode)"},{"line_number":1081,"context_line":"\t\twrp2y_sectors_offset \u003d stm32l4_info-\u003ebank1_sectors;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"917471f2_00add763","line":1078,"range":{"start_line":1078,"start_character":1,"end_line":1078,"end_character":39},"in_reply_to":"197a6ad5_fb5b31a8","updated":"2021-09-20 15:25:28.000000000","message":"Done","commit_id":"589295f668eed00206140c9462d09d648136508e"}]}
