On 05/21/2015 03:20 PM, Gabriel Krisman Bertazi wrote:
> +#define SGE_PAGE_SHIFT               12
> +#define SGE_PAGE_SIZE                (1 << SGE_PAGE_SHIFT)
...
> +struct bnx2x_alloc_pool {
> +     struct page     *page;
> +     dma_addr_t      dma;
> +     u8              offset;
> +     u8              frag_count;
> +};
...
>  static int bnx2x_alloc_rx_sge(struct bnx2x *bp, struct bnx2x_fastpath *fp,
>                             u16 index, gfp_t gfp_mask)
>  {
        ...
> +     pool->offset += SGE_PAGE_SIZE;
> +     pool->frag_count--;
> +
>       return 0;
>  }

One SGE_PAGE_SIZE is already bigger than representable by u8, so offset
will overflow.

Isn't storing both 'offset' and 'frag_count' redundant? There is a
simple linear relationship between the two.

Regards,
Michal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to