Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 822143ac authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-Use-FIELD_SIZEOF-directly-instead-of-reimplementing-its-function'



zhong jiang says:

====================
net: Use FIELD_SIZEOF directly instead of reimplementing its function

The issue is detected with the help of Coccinelle.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 18522108 a90546e8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -440,7 +440,7 @@ struct qede_fastpath {
	struct qede_tx_queue	*txq;
	struct qede_tx_queue	*xdp_tx;

#define VEC_NAME_SIZE	(sizeof(((struct net_device *)0)->name) + 8)
#define VEC_NAME_SIZE  (FIELD_SIZEOF(struct net_device, name) + 8)
	char	name[VEC_NAME_SIZE];
};

+3 −3
Original line number Diff line number Diff line
@@ -484,13 +484,13 @@ enum {
};

#define CPSW_STAT(m)		CPSW_STATS,				\
				sizeof(((struct cpsw_hw_stats *)0)->m), \
				FIELD_SIZEOF(struct cpsw_hw_stats, m), \
				offsetof(struct cpsw_hw_stats, m)
#define CPDMA_RX_STAT(m)	CPDMA_RX_STATS,				   \
				sizeof(((struct cpdma_chan_stats *)0)->m), \
				FIELD_SIZEOF(struct cpdma_chan_stats, m), \
				offsetof(struct cpdma_chan_stats, m)
#define CPDMA_TX_STAT(m)	CPDMA_TX_STATS,				   \
				sizeof(((struct cpdma_chan_stats *)0)->m), \
				FIELD_SIZEOF(struct cpdma_chan_stats, m), \
				offsetof(struct cpdma_chan_stats, m)

static const struct cpsw_stats cpsw_gstrings_stats[] = {
+5 −5
Original line number Diff line number Diff line
@@ -382,8 +382,8 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
	offset += sizeof(struct gre_base_hdr);

	if (hdr->flags & GRE_CSUM)
		offset += sizeof(((struct gre_full_hdr *) 0)->csum) +
			  sizeof(((struct gre_full_hdr *) 0)->reserved1);
		offset += FIELD_SIZEOF(struct gre_full_hdr, csum) +
			  FIELD_SIZEOF(struct gre_full_hdr, reserved1);

	if (hdr->flags & GRE_KEY) {
		const __be32 *keyid;
@@ -405,11 +405,11 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
			else
				key_keyid->keyid = *keyid & GRE_PPTP_KEY_MASK;
		}
		offset += sizeof(((struct gre_full_hdr *) 0)->key);
		offset += FIELD_SIZEOF(struct gre_full_hdr, key);
	}

	if (hdr->flags & GRE_SEQ)
		offset += sizeof(((struct pptp_gre_header *) 0)->seq);
		offset += FIELD_SIZEOF(struct pptp_gre_header, seq);

	if (gre_ver == 0) {
		if (*p_proto == htons(ETH_P_TEB)) {
@@ -436,7 +436,7 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
		u8 *ppp_hdr;

		if (hdr->flags & GRE_ACK)
			offset += sizeof(((struct pptp_gre_header *) 0)->ack);
			offset += FIELD_SIZEOF(struct pptp_gre_header, ack);

		ppp_hdr = __skb_header_pointer(skb, *p_nhoff + offset,
					       sizeof(_ppp_hdr),
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ static struct iucv_interface *pr_iucv;
static const u8 iprm_shutdown[8] =
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};

#define TRGCLS_SIZE	(sizeof(((struct iucv_message *)0)->class))
#define TRGCLS_SIZE	FIELD_SIZEOF(struct iucv_message, class)

#define __iucv_sock_wait(sk, condition, timeo, ret)			\
do {									\
+1 −1
Original line number Diff line number Diff line
@@ -993,7 +993,7 @@ static int fl_init_mask_hashtable(struct fl_flow_mask *mask)
}

#define FL_KEY_MEMBER_OFFSET(member) offsetof(struct fl_flow_key, member)
#define FL_KEY_MEMBER_SIZE(member) (sizeof(((struct fl_flow_key *) 0)->member))
#define FL_KEY_MEMBER_SIZE(member) FIELD_SIZEOF(struct fl_flow_key, member)

#define FL_KEY_IS_MASKED(mask, member)						\
	memchr_inv(((char *)mask) + FL_KEY_MEMBER_OFFSET(member),		\