Skip to content
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

wi-sun stack ws_bootstrap_neighbor_info_get return one more info #15372

Open
mcuxmx opened this issue Jan 13, 2023 · 2 comments
Open

wi-sun stack ws_bootstrap_neighbor_info_get return one more info #15372

mcuxmx opened this issue Jan 13, 2023 · 2 comments

Comments

@mcuxmx
Copy link

mcuxmx commented Jan 13, 2023

Description of defect

Target(s) affected by this defect ?

N/A

Toolchain(s) (name and version) displaying this defect ?

N/A

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.16.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

N/A

How is this defect reproduced ?

When the input parameter table_max of the function ws_bootstrap_neighbor_info_get is smaller than the number of neighbor tables (mac_neighbor_info(cur)->list_total_size), the function will return one more neighbor information.
For example: when table_max=16, the current number of neighbors is 20 mac_neighbor_info(cur)->list_total_size=20, the function will return 17 neighbor information.

for (int n = 0; n < mac_neighbor_info(cur)->list_total_size; n++) {
if (count > table_max) {
break;
}

The expression “count > table_max” probably should be “count >= table_max”

@mbedmain
Copy link

@mcuxmx thank you for raising this issue.Please take a look at the following comments:

Could you add some more detail to the description? A good description should be at least 25 words.

NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'. This indicates to us that at least all the fields have been considered.
Please update the issue header with the missing information.

@mcuxmx
Copy link
Author

mcuxmx commented Jan 13, 2023

also, wouldn't it be better to define the data type of variable "count" in line 2524 as uint16_t?

int ws_bootstrap_neighbor_info_get(protocol_interface_info_entry_t *cur, ws_neighbour_info_t *neighbor_ptr, uint16_t table_max)
{
uint8_t count = 0;
if (!neighbor_ptr) {
// Return the aount of neighbors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants