John Crispin <j...@phrozen.org> [2021-05-11 17:22:43]:

Hi,

>  package/network/config/realtek-poe/src/main.c | 844 ++++++++++++++++++

I would prefer to have this as out of tree project, so we could add CI
pipeline to it for improved QA.

> +struct port_config {
> +     char name[16];

It would be nice to get rid of all those magic numbers as well, there is a lot
of them.

Ideally the command bytes offsets should be defined (via some enum?) as well,
so it's easier to review the code otherwise one would need to keep in head,
that byte 11 is CRC etc.

> +     fprintf(stderr, "%s ->", type);
> +     for (i = 0; i < 12; i++)
> +             fprintf(stderr, " 0x%02x", data[i]);
> +     fprintf(stderr, "\n");

ULOG_DBG ?

> +     config.port_count = reply[3];

this should be checked for > MAX_PORT

> +     state.ports[reply[2]].poe_mode = GET_STR(reply[3], mode);

reply[2] should be checked for > MAX_PORT

> +     for (i = 0; i < 8; i++)

i < MAX_PORT

> +     state.ports[reply[2]].watt = watt;

reply[2] should be checked for > MAX_PORT

> +     if (ret)
> +             fprintf(stderr, "Failed to add object: %s\n", 
> ubus_strerror(ret));

ULOG_ERR ?

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to