treewide: Use sizeof_field() macro
Replace all the occurrences of FIELD_SIZEOF() with sizeof_field() except at places where these are defined. Later patches will remove the unused definition of FIELD_SIZEOF(). This patch is generated using following script: EXCLUDE_FILES="include/linux/stddef.h|include/linux/kernel.h" git grep -l -e "\bFIELD_SIZEOF\b" | while read file; do if [[ "$file" =~ $EXCLUDE_FILES ]]; then continue fi sed -i -e 's/\bFIELD_SIZEOF\b/sizeof_field/g' $file; done Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> Link: https://lore.kernel.org/r/20190924105839.110713-3-pankaj.laxminarayan.bharadiya@intel.com Co-developed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: David Miller <davem@davemloft.net> # for net
This commit is contained in:

committed by
Kees Cook

parent
e43723292d
commit
c593642c8b
@@ -15,7 +15,7 @@ struct ice_stats {
|
||||
|
||||
#define ICE_STAT(_type, _name, _stat) { \
|
||||
.stat_string = _name, \
|
||||
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
|
||||
.sizeof_stat = sizeof_field(_type, _stat), \
|
||||
.stat_offset = offsetof(_type, _stat) \
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ static int ice_q_stats_len(struct net_device *netdev)
|
||||
#define ICE_VSI_STATS_LEN ARRAY_SIZE(ice_gstrings_vsi_stats)
|
||||
|
||||
#define ICE_PFC_STATS_LEN ( \
|
||||
(FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_rx) + \
|
||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xon_rx) + \
|
||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_tx) + \
|
||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xon_tx)) \
|
||||
(sizeof_field(struct ice_pf, stats.priority_xoff_rx) + \
|
||||
sizeof_field(struct ice_pf, stats.priority_xon_rx) + \
|
||||
sizeof_field(struct ice_pf, stats.priority_xoff_tx) + \
|
||||
sizeof_field(struct ice_pf, stats.priority_xon_tx)) \
|
||||
/ sizeof(u64))
|
||||
#define ICE_ALL_STATS_LEN(n) (ICE_PF_STATS_LEN + ICE_PFC_STATS_LEN + \
|
||||
ICE_VSI_STATS_LEN + ice_q_stats_len(n))
|
||||
|
@@ -302,7 +302,7 @@ struct ice_ctx_ele {
|
||||
|
||||
#define ICE_CTX_STORE(_struct, _ele, _width, _lsb) { \
|
||||
.offset = offsetof(struct _struct, _ele), \
|
||||
.size_of = FIELD_SIZEOF(struct _struct, _ele), \
|
||||
.size_of = sizeof_field(struct _struct, _ele), \
|
||||
.width = _width, \
|
||||
.lsb = _lsb, \
|
||||
}
|
||||
|
Reference in New Issue
Block a user