Roi Dayan <r...@nvidia.com> writes:

> --- a/dcb/dcb_app.c
> +++ b/dcb/dcb_app.c
> @@ -65,8 +65,7 @@ static void dcb_app_table_fini(struct dcb_app_table *tab)
>  
>  static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app)
>  {
> -     struct dcb_app *apps = reallocarray(tab->apps, tab->n_apps + 1,
> -                                         sizeof(*tab->apps));
> +     struct dcb_app *apps = realloc(tab->apps, (tab->n_apps + 1) * 
> sizeof(*tab->apps));

reallocarray() checks that count*size does not overflow. But the whole
APP table needs to fit into one attribute, which limits the size to some
64K, so from UAPI direction this will never overflow. From the
command-line direction, size of 'struct app' is 4 bytes, so to overflow
you'd need to stuff in 1G APP entries. I think we don't need to worry
about that.

So this looks good.

Reviewed-by: Petr Machata <pe...@nvidia.com>

Reply via email to