unsigned int n_tables;
        unsigned long missed;
-       struct udp_tunnel_nic_table_entry **entries;
+       struct udp_tunnel_nic_table_entry *entries[] __counted_by(n_tables);
 };
 
 /* We ensure all work structs are done using driver state, but not the code.
        struct udp_tunnel_nic *utn;
        unsigned int i;
 
-       utn = kzalloc(sizeof(*utn), GFP_KERNEL);
+       utn = kzalloc(struct_size(utn, entries, n_tables), GFP_KERNEL);
        if (!utn)
                return NULL;
        utn->n_tables = n_tables;
        INIT_WORK(&utn->work, udp_tunnel_nic_device_sync_work);
 
-       utn->entries = kmalloc_array(n_tables, sizeof(void *), GFP_KERNEL);
-       if (!utn->entries)
-               goto err_free_utn;
-
        for (i = 0; i < n_tables; i++) {
                utn->entries[i] = kcalloc(info->tables[i].n_entries,
                                          sizeof(*utn->entries[i]), GFP_KERNEL);
 err_free_prev_entries:
        while (i--)
                kfree(utn->entries[i]);
-       kfree(utn->entries);
-err_free_utn:
        kfree(utn);
        return NULL;
 }
 
        for (i = 0; i < utn->n_tables; i++)
                kfree(utn->entries[i]);
-       kfree(utn->entries);
        kfree(utn);
 }