IMO
                ptr =
                    (void *)__get_free_pages(GFP_KERNEL,
                                             get_order(size));
                if ((unsigned long)ptr & 0x07) {
                        free_pages((unsigned long)ptr, get_order(size));
                        ptr = NULL;
                        /* Increment the size required if the first
                         * attempt failed.
                         */
                        if (!retries)
                                size += 7;
                }

in drivers/net/ethernet/cavium/liquidio/octeon_main.h:cnnic_alloc_aligned_dma()
takes defensive programming a bit too far - "if the page returned by
__get_free_pages() is not 64bit-aligned" is not going to trigger until
we start to support an architecture with page size lower than 8 bytes,
which is... unlikely.

Either this code takes paranoia to a truly impressive level, or something
else had been intended.  I tried to guess what that something might've
been, but it's hard to do without seeing the history prior to the
moment when it went into mainline.  The bit in the end is particularly
interesting:
        if ((unsigned long)ptr & 0x07)
                ptr = (void *)(((unsigned long)ptr + 7) & ~(7UL));
That - after having rejected such misaligned pointers.

Something's fishy in that code...
--
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