lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 22 Dec 2020 15:44:33 +0200 From: Vladimir Oltean <vladimir.oltean@....com> To: Andrew Lunn <andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>, Vivien Didelot <vivien.didelot@...il.com> Cc: Richard Cochran <richardcochran@...il.com>, Claudiu Manoil <claudiu.manoil@....com>, Alexandru Marginean <alexandru.marginean@....com>, Alexandre Belloni <alexandre.belloni@...tlin.com>, Xiaoliang Yang <xiaoliang.yang_1@....com>, Hongbo Wang <hongbo.wang@....com>, Po Liu <po.liu@....com>, Yangbo Lu <yangbo.lu@....com>, "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org, UNGLinuxDriver@...rochip.com Subject: [RFC PATCH v2 net-next 09/15] net: mscc: ocelot: use DIV_ROUND_UP helper in ocelot_port_inject_frame This looks a bit nicer than the open-coded "(x + 3) % 4" idiom. Signed-off-by: Vladimir Oltean <vladimir.oltean@....com> --- Changes in v2: Patch is new. drivers/net/ethernet/mscc/ocelot_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index 3a3bbd5e7883..7cc0fcd1df8d 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -386,7 +386,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev) ocelot_write_rix(ocelot, (__force u32)cpu_to_be32(ifh[i]), QS_INJ_WR, grp); - count = (skb->len + 3) / 4; + count = DIV_ROUND_UP(skb->len, 4); last = skb->len % 4; for (i = 0; i < count; i++) ocelot_write_rix(ocelot, ((u32 *)skb->data)[i], QS_INJ_WR, grp); -- 2.25.1
Powered by blists - more mailing lists