sh_eth: use DIV_ROUND_UP() in sh_eth_soft_swap()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sat, 2 Jun 2018 19:40:16 +0000 (22:40 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Jun 2018 19:23:25 +0000 (15:23 -0400)
When initializing 'maxp' in sh_eth_soft_swap(), the buffer length needs
to be rounded  up -- that's just asking for DIV_ROUND_UP()!

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index 82b03f1..e9007b6 100644 (file)
@@ -464,7 +464,7 @@ static void sh_eth_soft_swap(char *src, int len)
 {
 #ifdef __LITTLE_ENDIAN
        u32 *p = (u32 *)src;
-       u32 *maxp = p + ((len + sizeof(u32) - 1) / sizeof(u32));
+       u32 *maxp = p + DIV_ROUND_UP(len, sizeof(u32));
 
        for (; p < maxp; p++)
                *p = swab32(*p);