net: tc35815: Explicitly check NET_IP_ALIGN is not zero in tc35815_rx [Linux 4.14.143]

This Linux kernel change "net: tc35815: Explicitly check NET_IP_ALIGN is not zero in tc35815_rx" is included in the Linux 4.14.143 release. This change is authored by Nathan Chancellor <natechancellor [at]> on Sun Aug 11 20:13:45 2019 -0700. The commit for this change in Linux stable tree is 7a28a90 (patch) which is from upstream commit 125b7e0. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 125b7e0.

net: tc35815: Explicitly check NET_IP_ALIGN is not zero in tc35815_rx

[ Upstream commit 125b7e0949d4e72b15c2b1a1590f8cece985a918 ]

clang warns:

drivers/net/ethernet/toshiba/tc35815.c:1507:30: warning: use of logical
'&&' with constant operand [-Wconstant-logical-operand]
                        if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN)
                                                  ^  ~~~~~~~~~~~~
drivers/net/ethernet/toshiba/tc35815.c:1507:30: note: use '&' for a
bitwise operation
                        if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN)
drivers/net/ethernet/toshiba/tc35815.c:1507:30: note: remove constant to
silence this warning
                        if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN)
1 warning generated.

Explicitly check that NET_IP_ALIGN is not zero, which matches how this
is checked in other parts of the tree. Because NET_IP_ALIGN is a build
time constant, this check will be constant folded away during

Fixes: 82a9928db560 ("tc35815: Enable StripCRC feature")
Signed-off-by: Nathan Chancellor <>
Signed-off-by: David S. Miller <>
Signed-off-by: Sasha Levin <>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/toshiba/tc35815.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index cce9c9e..9146068 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -1497,7 +1497,7 @@ static void tc35815_poll_controller(struct net_device *dev)
                     RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
-           if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN)
+           if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN != 0)
                memmove(skb->data, skb->data - NET_IP_ALIGN,
            data = skb_put(skb, pkt_len);

Leave a Reply

Your email address will not be published. Required fields are marked *