* [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function
@ 2018-09-19 11:32 zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 1/5] net: iucv: " zhong jiang
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
The issue is detected with the help of Coccinelle.
zhong jiang (5):
net: iucv: Use FIELD_SIZEOF directly instead of reimplementing its
function
net: sched: Use FIELD_SIZEOF directly instead of reimplementing its
function
net: core: Use FIELD_SIZEOF directly instead of reimplementing its
function
net: qede: Use FIELD_SIZEOF directly instead of reimplementing its
function
net: ti: Use FIELD_SIZEOF directly instead of reimplementing its
function
drivers/net/ethernet/qlogic/qede/qede.h | 2 +-
drivers/net/ethernet/ti/cpsw.c | 6 +++---
net/core/flow_dissector.c | 10 +++++-----
net/iucv/af_iucv.c | 2 +-
net/sched/cls_flower.c | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RESEND PATCH 1/5] net: iucv: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
@ 2018-09-19 11:32 ` zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 2/5] net: sched: " zhong jiang
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
net/iucv/af_iucv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index e2f16a0..5b68ee9 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -48,7 +48,7 @@
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.7.12.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RESEND PATCH 2/5] net: sched: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 1/5] net: iucv: " zhong jiang
@ 2018-09-19 11:32 ` zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 3/5] net: core: " zhong jiang
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
net/sched/cls_flower.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 4b8dd37..9aada2d 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -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), \
--
1.7.12.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RESEND PATCH 3/5] net: core: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 1/5] net: iucv: " zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 2/5] net: sched: " zhong jiang
@ 2018-09-19 11:32 ` zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 4/5] net: qede: " zhong jiang
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
net/core/flow_dissector.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 5c5dd74..aeac884 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -423,8 +423,8 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
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;
@@ -446,11 +446,11 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
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)) {
@@ -477,7 +477,7 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
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.7.12.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RESEND PATCH 4/5] net: qede: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
` (2 preceding siblings ...)
2018-09-19 11:32 ` [RESEND PATCH 3/5] net: core: " zhong jiang
@ 2018-09-19 11:32 ` zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 5/5] net: ti: " zhong jiang
2018-09-20 3:58 ` [RESEND PATCH 0/5] net: " David Miller
5 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ethernet/qlogic/qede/qede.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h
index 6a4d266..de98a97 100644
--- a/drivers/net/ethernet/qlogic/qede/qede.h
+++ b/drivers/net/ethernet/qlogic/qede/qede.h
@@ -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];
};
--
1.7.12.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RESEND PATCH 5/5] net: ti: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
` (3 preceding siblings ...)
2018-09-19 11:32 ` [RESEND PATCH 4/5] net: qede: " zhong jiang
@ 2018-09-19 11:32 ` zhong jiang
2018-09-20 3:58 ` [RESEND PATCH 0/5] net: " David Miller
5 siblings, 0 replies; 7+ messages in thread
From: zhong jiang @ 2018-09-19 11:32 UTC (permalink / raw)
To: davem
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ethernet/ti/cpsw.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 832bce0..16dcbf3 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -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[] = {
--
1.7.12.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
` (4 preceding siblings ...)
2018-09-19 11:32 ` [RESEND PATCH 5/5] net: ti: " zhong jiang
@ 2018-09-20 3:58 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-09-20 3:58 UTC (permalink / raw)
To: zhongjiang
Cc: ubraun, jwi, jhs, xiyou.wangcong, Ariel.Elior, everest-linux-l2,
grygorii.strashko, netdev, linux-kernel, borntraeger
From: zhong jiang <zhongjiang@huawei.com>
Date: Wed, 19 Sep 2018 19:32:09 +0800
> The issue is detected with the help of Coccinelle.
Series applied, thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-09-20 3:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 11:32 [RESEND PATCH 0/5] net: Use FIELD_SIZEOF directly instead of reimplementing its function zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 1/5] net: iucv: " zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 2/5] net: sched: " zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 3/5] net: core: " zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 4/5] net: qede: " zhong jiang
2018-09-19 11:32 ` [RESEND PATCH 5/5] net: ti: " zhong jiang
2018-09-20 3:58 ` [RESEND PATCH 0/5] net: " David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).