On Mon, Sep 02, 2013 at 11:28:10AM +0900, Simon Horman wrote:
> struct ofputil_group_stats has an arbitrary limit
> of 16 buckets for which it can record statistics.
> However the code does not appear to enforce this
> limit and it seems to me that the code could overflow.
> 
> This patch aims to remove the arbitrary limit by
> removing the 'bucket_stats' field from struct ofputil_group_stats
> and instead allowing an instance of that structure to be
> followed by an any number of struct bucket_counter.
> 
> Signed-off-by: Simon Horman <ho...@verge.net.au>

I tend to regard data structures that end with an explicit or (as
here) implicit variable-length array as somewhat confusing, at least
more so than simpler solutions.  Thus, I use them as an optimization
that one does in cases where time or space is at a premium.  But I
don't think that either is a problem here, so I would prefer to avoid
using one.

Would you mind, therefore, recasting this in terms of an explicit
pointer, something like:

     uint32_t n_buckets;
     struct bucket_counter *bucket_stats;

Thanks,

Ben.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to