sh_eth: use DIV_ROUND_UP() in sh_eth_soft_swap()
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>
This commit is contained in:
parent
bb2fa4e847
commit
1100149a23
|
@ -464,7 +464,7 @@ static void sh_eth_soft_swap(char *src, int len)
|
||||||
{
|
{
|
||||||
#ifdef __LITTLE_ENDIAN
|
#ifdef __LITTLE_ENDIAN
|
||||||
u32 *p = (u32 *)src;
|
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++)
|
for (; p < maxp; p++)
|
||||||
*p = swab32(*p);
|
*p = swab32(*p);
|
||||||
|
|
Loading…
Reference in New Issue