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
@@ -312,7 +312,7 @@ static void tcf_ct_act_set_labels(struct nf_conn *ct,
|
||||
u32 *labels_m)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS)
|
||||
size_t labels_sz = FIELD_SIZEOF(struct tcf_ct_params, labels);
|
||||
size_t labels_sz = sizeof_field(struct tcf_ct_params, labels);
|
||||
|
||||
if (!memchr_inv(labels_m, 0, labels_sz))
|
||||
return;
|
||||
@@ -936,7 +936,7 @@ static struct tc_action_ops act_ct_ops = {
|
||||
|
||||
static __net_init int ct_init_net(struct net *net)
|
||||
{
|
||||
unsigned int n_bits = FIELD_SIZEOF(struct tcf_ct_params, labels) * 8;
|
||||
unsigned int n_bits = sizeof_field(struct tcf_ct_params, labels) * 8;
|
||||
struct tc_ct_action_net *tn = net_generic(net, ct_net_id);
|
||||
|
||||
if (nf_connlabels_get(net, n_bits - 1)) {
|
||||
|
Reference in New Issue
Block a user