mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
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:
parent
e43723292d
commit
c593642c8b
@ -988,7 +988,7 @@ Similarly, if you need to calculate the size of some structure member, use
|
|||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
|
#define sizeof_field(t, f) (sizeof(((t*)0)->f))
|
||||||
|
|
||||||
There are also min() and max() macros that do strict type checking if you
|
There are also min() and max() macros that do strict type checking if you
|
||||||
need them. Feel free to peruse that header file to see what else is already
|
need them. Feel free to peruse that header file to see what else is already
|
||||||
|
@ -1005,7 +1005,7 @@ struttura, usate
|
|||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
|
#define sizeof_field(t, f) (sizeof(((t*)0)->f))
|
||||||
|
|
||||||
Ci sono anche le macro min() e max() che, se vi serve, effettuano un controllo
|
Ci sono anche le macro min() e max() che, se vi serve, effettuano un controllo
|
||||||
rigido sui tipi. Sentitevi liberi di leggere attentamente questo file
|
rigido sui tipi. Sentitevi liberi di leggere attentamente questo file
|
||||||
|
@ -826,7 +826,7 @@ inline gcc 也可以自动使其内联。而且其他用户可能会要求移除
|
|||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
|
#define sizeof_field(t, f) (sizeof(((t*)0)->f))
|
||||||
|
|
||||||
还有可以做严格的类型检查的 min() 和 max() 宏,如果你需要可以使用它们。你可以
|
还有可以做严格的类型检查的 min() 和 max() 宏,如果你需要可以使用它们。你可以
|
||||||
自己看看那个头文件里还定义了什么你可以拿来用的东西,如果有定义的话,你就不应
|
自己看看那个头文件里还定义了什么你可以拿来用的东西,如果有定义的话,你就不应
|
||||||
|
@ -42,10 +42,10 @@ do { \
|
|||||||
|
|
||||||
#define EXTRA_INFO(f) { \
|
#define EXTRA_INFO(f) { \
|
||||||
BUILD_BUG_ON_ZERO(offsetof(struct unwind_frame_info, f) \
|
BUILD_BUG_ON_ZERO(offsetof(struct unwind_frame_info, f) \
|
||||||
% FIELD_SIZEOF(struct unwind_frame_info, f)) \
|
% sizeof_field(struct unwind_frame_info, f)) \
|
||||||
+ offsetof(struct unwind_frame_info, f) \
|
+ offsetof(struct unwind_frame_info, f) \
|
||||||
/ FIELD_SIZEOF(struct unwind_frame_info, f), \
|
/ sizeof_field(struct unwind_frame_info, f), \
|
||||||
FIELD_SIZEOF(struct unwind_frame_info, f) \
|
sizeof_field(struct unwind_frame_info, f) \
|
||||||
}
|
}
|
||||||
#define PTREGS_INFO(f) EXTRA_INFO(regs.f)
|
#define PTREGS_INFO(f) EXTRA_INFO(regs.f)
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
|
|||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
#ifdef CONFIG_PPC64
|
#ifdef CONFIG_PPC64
|
||||||
#define PPC_BPF_LOAD_CPU(r) \
|
#define PPC_BPF_LOAD_CPU(r) \
|
||||||
do { BUILD_BUG_ON(FIELD_SIZEOF(struct paca_struct, paca_index) != 2); \
|
do { BUILD_BUG_ON(sizeof_field(struct paca_struct, paca_index) != 2); \
|
||||||
PPC_LHZ_OFFS(r, 13, offsetof(struct paca_struct, paca_index)); \
|
PPC_LHZ_OFFS(r, 13, offsetof(struct paca_struct, paca_index)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define PPC_BPF_LOAD_CPU(r) \
|
#define PPC_BPF_LOAD_CPU(r) \
|
||||||
do { BUILD_BUG_ON(FIELD_SIZEOF(struct task_struct, cpu) != 4); \
|
do { BUILD_BUG_ON(sizeof_field(struct task_struct, cpu) != 4); \
|
||||||
PPC_LHZ_OFFS(r, 2, offsetof(struct task_struct, cpu)); \
|
PPC_LHZ_OFFS(r, 2, offsetof(struct task_struct, cpu)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -321,7 +321,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
|
|||||||
ctx->seen |= SEEN_XREG | SEEN_MEM | (1<<(K & 0xf));
|
ctx->seen |= SEEN_XREG | SEEN_MEM | (1<<(K & 0xf));
|
||||||
break;
|
break;
|
||||||
case BPF_LD | BPF_W | BPF_LEN: /* A = skb->len; */
|
case BPF_LD | BPF_W | BPF_LEN: /* A = skb->len; */
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, len) != 4);
|
||||||
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, len));
|
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, len));
|
||||||
break;
|
break;
|
||||||
case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */
|
case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */
|
||||||
@ -333,16 +333,16 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
|
|||||||
|
|
||||||
/*** Ancillary info loads ***/
|
/*** Ancillary info loads ***/
|
||||||
case BPF_ANC | SKF_AD_PROTOCOL: /* A = ntohs(skb->protocol); */
|
case BPF_ANC | SKF_AD_PROTOCOL: /* A = ntohs(skb->protocol); */
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
|
BUILD_BUG_ON(sizeof_field(struct sk_buff,
|
||||||
protocol) != 2);
|
protocol) != 2);
|
||||||
PPC_NTOHS_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_NTOHS_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
protocol));
|
protocol));
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_IFINDEX:
|
case BPF_ANC | SKF_AD_IFINDEX:
|
||||||
case BPF_ANC | SKF_AD_HATYPE:
|
case BPF_ANC | SKF_AD_HATYPE:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
|
BUILD_BUG_ON(sizeof_field(struct net_device,
|
||||||
ifindex) != 4);
|
ifindex) != 4);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
|
BUILD_BUG_ON(sizeof_field(struct net_device,
|
||||||
type) != 2);
|
type) != 2);
|
||||||
PPC_LL_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
|
PPC_LL_OFFS(r_scratch1, r_skb, offsetof(struct sk_buff,
|
||||||
dev));
|
dev));
|
||||||
@ -365,17 +365,17 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_MARK:
|
case BPF_ANC | SKF_AD_MARK:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, mark) != 4);
|
||||||
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
mark));
|
mark));
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_RXHASH:
|
case BPF_ANC | SKF_AD_RXHASH:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, hash) != 4);
|
||||||
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
hash));
|
hash));
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_VLAN_TAG:
|
case BPF_ANC | SKF_AD_VLAN_TAG:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_tci) != 2);
|
||||||
|
|
||||||
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
vlan_tci));
|
vlan_tci));
|
||||||
@ -388,7 +388,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
|
|||||||
PPC_ANDI(r_A, r_A, 1);
|
PPC_ANDI(r_A, r_A, 1);
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_QUEUE:
|
case BPF_ANC | SKF_AD_QUEUE:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
|
BUILD_BUG_ON(sizeof_field(struct sk_buff,
|
||||||
queue_mapping) != 2);
|
queue_mapping) != 2);
|
||||||
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
queue_mapping));
|
queue_mapping));
|
||||||
|
@ -180,19 +180,19 @@ do { \
|
|||||||
|
|
||||||
#define emit_loadptr(BASE, STRUCT, FIELD, DEST) \
|
#define emit_loadptr(BASE, STRUCT, FIELD, DEST) \
|
||||||
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(void *)); \
|
BUILD_BUG_ON(sizeof_field(STRUCT, FIELD) != sizeof(void *)); \
|
||||||
*prog++ = LDPTRI | RS1(BASE) | S13(_off) | RD(DEST); \
|
*prog++ = LDPTRI | RS1(BASE) | S13(_off) | RD(DEST); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define emit_load32(BASE, STRUCT, FIELD, DEST) \
|
#define emit_load32(BASE, STRUCT, FIELD, DEST) \
|
||||||
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u32)); \
|
BUILD_BUG_ON(sizeof_field(STRUCT, FIELD) != sizeof(u32)); \
|
||||||
*prog++ = LD32I | RS1(BASE) | S13(_off) | RD(DEST); \
|
*prog++ = LD32I | RS1(BASE) | S13(_off) | RD(DEST); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define emit_load16(BASE, STRUCT, FIELD, DEST) \
|
#define emit_load16(BASE, STRUCT, FIELD, DEST) \
|
||||||
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u16)); \
|
BUILD_BUG_ON(sizeof_field(STRUCT, FIELD) != sizeof(u16)); \
|
||||||
*prog++ = LD16I | RS1(BASE) | S13(_off) | RD(DEST); \
|
*prog++ = LD16I | RS1(BASE) | S13(_off) | RD(DEST); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ do { unsigned int _off = offsetof(STRUCT, FIELD); \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define emit_load8(BASE, STRUCT, FIELD, DEST) \
|
#define emit_load8(BASE, STRUCT, FIELD, DEST) \
|
||||||
do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \
|
do { BUILD_BUG_ON(sizeof_field(STRUCT, FIELD) != sizeof(u8)); \
|
||||||
__emit_load8(BASE, STRUCT, FIELD, DEST); \
|
__emit_load8(BASE, STRUCT, FIELD, DEST); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ static void __init setup_xstate_features(void)
|
|||||||
xmm_space);
|
xmm_space);
|
||||||
|
|
||||||
xstate_offsets[XFEATURE_SSE] = xstate_sizes[XFEATURE_FP];
|
xstate_offsets[XFEATURE_SSE] = xstate_sizes[XFEATURE_FP];
|
||||||
xstate_sizes[XFEATURE_SSE] = FIELD_SIZEOF(struct fxregs_state,
|
xstate_sizes[XFEATURE_SSE] = sizeof_field(struct fxregs_state,
|
||||||
xmm_space);
|
xmm_space);
|
||||||
|
|
||||||
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
||||||
|
@ -1792,9 +1792,9 @@ int __init blk_dev_init(void)
|
|||||||
{
|
{
|
||||||
BUILD_BUG_ON(REQ_OP_LAST >= (1 << REQ_OP_BITS));
|
BUILD_BUG_ON(REQ_OP_LAST >= (1 << REQ_OP_BITS));
|
||||||
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
|
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
|
||||||
FIELD_SIZEOF(struct request, cmd_flags));
|
sizeof_field(struct request, cmd_flags));
|
||||||
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
|
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
|
||||||
FIELD_SIZEOF(struct bio, bi_opf));
|
sizeof_field(struct bio, bi_opf));
|
||||||
|
|
||||||
/* used for unplugging and affects IO latency/throughput - HIGHPRI */
|
/* used for unplugging and affects IO latency/throughput - HIGHPRI */
|
||||||
kblockd_workqueue = alloc_workqueue("kblockd",
|
kblockd_workqueue = alloc_workqueue("kblockd",
|
||||||
|
@ -436,10 +436,10 @@ static int adiantum_init_tfm(struct crypto_skcipher *tfm)
|
|||||||
|
|
||||||
BUILD_BUG_ON(offsetofend(struct adiantum_request_ctx, u) !=
|
BUILD_BUG_ON(offsetofend(struct adiantum_request_ctx, u) !=
|
||||||
sizeof(struct adiantum_request_ctx));
|
sizeof(struct adiantum_request_ctx));
|
||||||
subreq_size = max(FIELD_SIZEOF(struct adiantum_request_ctx,
|
subreq_size = max(sizeof_field(struct adiantum_request_ctx,
|
||||||
u.hash_desc) +
|
u.hash_desc) +
|
||||||
crypto_shash_descsize(hash),
|
crypto_shash_descsize(hash),
|
||||||
FIELD_SIZEOF(struct adiantum_request_ctx,
|
sizeof_field(struct adiantum_request_ctx,
|
||||||
u.streamcipher_req) +
|
u.streamcipher_req) +
|
||||||
crypto_skcipher_reqsize(streamcipher));
|
crypto_skcipher_reqsize(streamcipher));
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ static int essiv_aead_init_tfm(struct crypto_aead *tfm)
|
|||||||
if (IS_ERR(aead))
|
if (IS_ERR(aead))
|
||||||
return PTR_ERR(aead);
|
return PTR_ERR(aead);
|
||||||
|
|
||||||
subreq_size = FIELD_SIZEOF(struct essiv_aead_request_ctx, aead_req) +
|
subreq_size = sizeof_field(struct essiv_aead_request_ctx, aead_req) +
|
||||||
crypto_aead_reqsize(aead);
|
crypto_aead_reqsize(aead);
|
||||||
|
|
||||||
tctx->ivoffset = offsetof(struct essiv_aead_request_ctx, aead_req) +
|
tctx->ivoffset = offsetof(struct essiv_aead_request_ctx, aead_req) +
|
||||||
|
@ -681,7 +681,7 @@ device_initcall(efi_load_efivars);
|
|||||||
{ name }, \
|
{ name }, \
|
||||||
{ prop }, \
|
{ prop }, \
|
||||||
offsetof(struct efi_fdt_params, field), \
|
offsetof(struct efi_fdt_params, field), \
|
||||||
FIELD_SIZEOF(struct efi_fdt_params, field) \
|
sizeof_field(struct efi_fdt_params, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct params {
|
struct params {
|
||||||
|
@ -145,7 +145,7 @@ static inline bool is_rdma_read_cap(struct efa_dev *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define field_avail(x, fld, sz) (offsetof(typeof(x), fld) + \
|
#define field_avail(x, fld, sz) (offsetof(typeof(x), fld) + \
|
||||||
FIELD_SIZEOF(typeof(x), fld) <= (sz))
|
sizeof_field(typeof(x), fld) <= (sz))
|
||||||
|
|
||||||
#define is_reserved_cleared(reserved) \
|
#define is_reserved_cleared(reserved) \
|
||||||
!memchr_inv(reserved, 0, sizeof(reserved))
|
!memchr_inv(reserved, 0, sizeof(reserved))
|
||||||
|
@ -848,7 +848,7 @@ static const struct rhashtable_params sdma_rht_params = {
|
|||||||
.nelem_hint = NR_CPUS_HINT,
|
.nelem_hint = NR_CPUS_HINT,
|
||||||
.head_offset = offsetof(struct sdma_rht_node, node),
|
.head_offset = offsetof(struct sdma_rht_node, node),
|
||||||
.key_offset = offsetof(struct sdma_rht_node, cpu_id),
|
.key_offset = offsetof(struct sdma_rht_node, cpu_id),
|
||||||
.key_len = FIELD_SIZEOF(struct sdma_rht_node, cpu_id),
|
.key_len = sizeof_field(struct sdma_rht_node, cpu_id),
|
||||||
.max_size = NR_CPUS,
|
.max_size = NR_CPUS,
|
||||||
.min_size = 8,
|
.min_size = 8,
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
|
@ -107,9 +107,9 @@ enum {
|
|||||||
HFI1_HAS_GRH = (1 << 0),
|
HFI1_HAS_GRH = (1 << 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LRH_16B_BYTES (FIELD_SIZEOF(struct hfi1_16b_header, lrh))
|
#define LRH_16B_BYTES (sizeof_field(struct hfi1_16b_header, lrh))
|
||||||
#define LRH_16B_DWORDS (LRH_16B_BYTES / sizeof(u32))
|
#define LRH_16B_DWORDS (LRH_16B_BYTES / sizeof(u32))
|
||||||
#define LRH_9B_BYTES (FIELD_SIZEOF(struct ib_header, lrh))
|
#define LRH_9B_BYTES (sizeof_field(struct ib_header, lrh))
|
||||||
#define LRH_9B_DWORDS (LRH_9B_BYTES / sizeof(u32))
|
#define LRH_9B_DWORDS (LRH_9B_BYTES / sizeof(u32))
|
||||||
|
|
||||||
/* 24Bits for qpn, upper 8Bits reserved */
|
/* 24Bits for qpn, upper 8Bits reserved */
|
||||||
|
@ -63,7 +63,7 @@ struct vnic_stats {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VNIC_STAT(m) { FIELD_SIZEOF(struct opa_vnic_stats, m), \
|
#define VNIC_STAT(m) { sizeof_field(struct opa_vnic_stats, m), \
|
||||||
offsetof(struct opa_vnic_stats, m) }
|
offsetof(struct opa_vnic_stats, m) }
|
||||||
|
|
||||||
static struct vnic_stats vnic_gstrings_stats[] = {
|
static struct vnic_stats vnic_gstrings_stats[] = {
|
||||||
|
@ -1360,7 +1360,7 @@ int ppl_init_log(struct r5conf *conf)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_disks = FIELD_SIZEOF(struct ppl_log, disk_flush_bitmap) *
|
max_disks = sizeof_field(struct ppl_log, disk_flush_bitmap) *
|
||||||
BITS_PER_BYTE;
|
BITS_PER_BYTE;
|
||||||
if (conf->raid_disks > max_disks) {
|
if (conf->raid_disks > max_disks) {
|
||||||
pr_warn("md/raid:%s PPL doesn't support over %d disks in the array\n",
|
pr_warn("md/raid:%s PPL doesn't support over %d disks in the array\n",
|
||||||
|
@ -753,7 +753,7 @@ static const struct preview_update update_attrs[] = {
|
|||||||
preview_config_luma_enhancement,
|
preview_config_luma_enhancement,
|
||||||
preview_enable_luma_enhancement,
|
preview_enable_luma_enhancement,
|
||||||
offsetof(struct prev_params, luma),
|
offsetof(struct prev_params, luma),
|
||||||
FIELD_SIZEOF(struct prev_params, luma),
|
sizeof_field(struct prev_params, luma),
|
||||||
offsetof(struct omap3isp_prev_update_config, luma),
|
offsetof(struct omap3isp_prev_update_config, luma),
|
||||||
}, /* OMAP3ISP_PREV_INVALAW */ {
|
}, /* OMAP3ISP_PREV_INVALAW */ {
|
||||||
NULL,
|
NULL,
|
||||||
@ -762,55 +762,55 @@ static const struct preview_update update_attrs[] = {
|
|||||||
preview_config_hmed,
|
preview_config_hmed,
|
||||||
preview_enable_hmed,
|
preview_enable_hmed,
|
||||||
offsetof(struct prev_params, hmed),
|
offsetof(struct prev_params, hmed),
|
||||||
FIELD_SIZEOF(struct prev_params, hmed),
|
sizeof_field(struct prev_params, hmed),
|
||||||
offsetof(struct omap3isp_prev_update_config, hmed),
|
offsetof(struct omap3isp_prev_update_config, hmed),
|
||||||
}, /* OMAP3ISP_PREV_CFA */ {
|
}, /* OMAP3ISP_PREV_CFA */ {
|
||||||
preview_config_cfa,
|
preview_config_cfa,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, cfa),
|
offsetof(struct prev_params, cfa),
|
||||||
FIELD_SIZEOF(struct prev_params, cfa),
|
sizeof_field(struct prev_params, cfa),
|
||||||
offsetof(struct omap3isp_prev_update_config, cfa),
|
offsetof(struct omap3isp_prev_update_config, cfa),
|
||||||
}, /* OMAP3ISP_PREV_CHROMA_SUPP */ {
|
}, /* OMAP3ISP_PREV_CHROMA_SUPP */ {
|
||||||
preview_config_chroma_suppression,
|
preview_config_chroma_suppression,
|
||||||
preview_enable_chroma_suppression,
|
preview_enable_chroma_suppression,
|
||||||
offsetof(struct prev_params, csup),
|
offsetof(struct prev_params, csup),
|
||||||
FIELD_SIZEOF(struct prev_params, csup),
|
sizeof_field(struct prev_params, csup),
|
||||||
offsetof(struct omap3isp_prev_update_config, csup),
|
offsetof(struct omap3isp_prev_update_config, csup),
|
||||||
}, /* OMAP3ISP_PREV_WB */ {
|
}, /* OMAP3ISP_PREV_WB */ {
|
||||||
preview_config_whitebalance,
|
preview_config_whitebalance,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, wbal),
|
offsetof(struct prev_params, wbal),
|
||||||
FIELD_SIZEOF(struct prev_params, wbal),
|
sizeof_field(struct prev_params, wbal),
|
||||||
offsetof(struct omap3isp_prev_update_config, wbal),
|
offsetof(struct omap3isp_prev_update_config, wbal),
|
||||||
}, /* OMAP3ISP_PREV_BLKADJ */ {
|
}, /* OMAP3ISP_PREV_BLKADJ */ {
|
||||||
preview_config_blkadj,
|
preview_config_blkadj,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, blkadj),
|
offsetof(struct prev_params, blkadj),
|
||||||
FIELD_SIZEOF(struct prev_params, blkadj),
|
sizeof_field(struct prev_params, blkadj),
|
||||||
offsetof(struct omap3isp_prev_update_config, blkadj),
|
offsetof(struct omap3isp_prev_update_config, blkadj),
|
||||||
}, /* OMAP3ISP_PREV_RGB2RGB */ {
|
}, /* OMAP3ISP_PREV_RGB2RGB */ {
|
||||||
preview_config_rgb_blending,
|
preview_config_rgb_blending,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, rgb2rgb),
|
offsetof(struct prev_params, rgb2rgb),
|
||||||
FIELD_SIZEOF(struct prev_params, rgb2rgb),
|
sizeof_field(struct prev_params, rgb2rgb),
|
||||||
offsetof(struct omap3isp_prev_update_config, rgb2rgb),
|
offsetof(struct omap3isp_prev_update_config, rgb2rgb),
|
||||||
}, /* OMAP3ISP_PREV_COLOR_CONV */ {
|
}, /* OMAP3ISP_PREV_COLOR_CONV */ {
|
||||||
preview_config_csc,
|
preview_config_csc,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, csc),
|
offsetof(struct prev_params, csc),
|
||||||
FIELD_SIZEOF(struct prev_params, csc),
|
sizeof_field(struct prev_params, csc),
|
||||||
offsetof(struct omap3isp_prev_update_config, csc),
|
offsetof(struct omap3isp_prev_update_config, csc),
|
||||||
}, /* OMAP3ISP_PREV_YC_LIMIT */ {
|
}, /* OMAP3ISP_PREV_YC_LIMIT */ {
|
||||||
preview_config_yc_range,
|
preview_config_yc_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof(struct prev_params, yclimit),
|
offsetof(struct prev_params, yclimit),
|
||||||
FIELD_SIZEOF(struct prev_params, yclimit),
|
sizeof_field(struct prev_params, yclimit),
|
||||||
offsetof(struct omap3isp_prev_update_config, yclimit),
|
offsetof(struct omap3isp_prev_update_config, yclimit),
|
||||||
}, /* OMAP3ISP_PREV_DEFECT_COR */ {
|
}, /* OMAP3ISP_PREV_DEFECT_COR */ {
|
||||||
preview_config_dcor,
|
preview_config_dcor,
|
||||||
preview_enable_dcor,
|
preview_enable_dcor,
|
||||||
offsetof(struct prev_params, dcor),
|
offsetof(struct prev_params, dcor),
|
||||||
FIELD_SIZEOF(struct prev_params, dcor),
|
sizeof_field(struct prev_params, dcor),
|
||||||
offsetof(struct omap3isp_prev_update_config, dcor),
|
offsetof(struct omap3isp_prev_update_config, dcor),
|
||||||
}, /* Previously OMAP3ISP_PREV_GAMMABYPASS, not used anymore */ {
|
}, /* Previously OMAP3ISP_PREV_GAMMABYPASS, not used anymore */ {
|
||||||
NULL,
|
NULL,
|
||||||
@ -828,13 +828,13 @@ static const struct preview_update update_attrs[] = {
|
|||||||
preview_config_noisefilter,
|
preview_config_noisefilter,
|
||||||
preview_enable_noisefilter,
|
preview_enable_noisefilter,
|
||||||
offsetof(struct prev_params, nf),
|
offsetof(struct prev_params, nf),
|
||||||
FIELD_SIZEOF(struct prev_params, nf),
|
sizeof_field(struct prev_params, nf),
|
||||||
offsetof(struct omap3isp_prev_update_config, nf),
|
offsetof(struct omap3isp_prev_update_config, nf),
|
||||||
}, /* OMAP3ISP_PREV_GAMMA */ {
|
}, /* OMAP3ISP_PREV_GAMMA */ {
|
||||||
preview_config_gammacorrn,
|
preview_config_gammacorrn,
|
||||||
preview_enable_gammacorrn,
|
preview_enable_gammacorrn,
|
||||||
offsetof(struct prev_params, gamma),
|
offsetof(struct prev_params, gamma),
|
||||||
FIELD_SIZEOF(struct prev_params, gamma),
|
sizeof_field(struct prev_params, gamma),
|
||||||
offsetof(struct omap3isp_prev_update_config, gamma),
|
offsetof(struct omap3isp_prev_update_config, gamma),
|
||||||
}, /* OMAP3ISP_PREV_CONTRAST */ {
|
}, /* OMAP3ISP_PREV_CONTRAST */ {
|
||||||
preview_config_contrast,
|
preview_config_contrast,
|
||||||
|
@ -2652,7 +2652,7 @@ struct v4l2_ioctl_info {
|
|||||||
/* Zero struct from after the field to the end */
|
/* Zero struct from after the field to the end */
|
||||||
#define INFO_FL_CLEAR(v4l2_struct, field) \
|
#define INFO_FL_CLEAR(v4l2_struct, field) \
|
||||||
((offsetof(struct v4l2_struct, field) + \
|
((offsetof(struct v4l2_struct, field) + \
|
||||||
FIELD_SIZEOF(struct v4l2_struct, field)) << 16)
|
sizeof_field(struct v4l2_struct, field)) << 16)
|
||||||
#define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16)
|
#define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16)
|
||||||
|
|
||||||
#define DEFINE_V4L_STUB_FUNC(_vidioc) \
|
#define DEFINE_V4L_STUB_FUNC(_vidioc) \
|
||||||
|
@ -129,13 +129,13 @@ struct xgbe_stats {
|
|||||||
|
|
||||||
#define XGMAC_MMC_STAT(_string, _var) \
|
#define XGMAC_MMC_STAT(_string, _var) \
|
||||||
{ _string, \
|
{ _string, \
|
||||||
FIELD_SIZEOF(struct xgbe_mmc_stats, _var), \
|
sizeof_field(struct xgbe_mmc_stats, _var), \
|
||||||
offsetof(struct xgbe_prv_data, mmc_stats._var), \
|
offsetof(struct xgbe_prv_data, mmc_stats._var), \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XGMAC_EXT_STAT(_string, _var) \
|
#define XGMAC_EXT_STAT(_string, _var) \
|
||||||
{ _string, \
|
{ _string, \
|
||||||
FIELD_SIZEOF(struct xgbe_ext_stats, _var), \
|
sizeof_field(struct xgbe_ext_stats, _var), \
|
||||||
offsetof(struct xgbe_prv_data, ext_stats._var), \
|
offsetof(struct xgbe_prv_data, ext_stats._var), \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,11 +205,11 @@ static int __cvmx_bootmem_check_version(struct octeon_device *oct,
|
|||||||
major_version = (u32)__cvmx_bootmem_desc_get(
|
major_version = (u32)__cvmx_bootmem_desc_get(
|
||||||
oct, oct->bootmem_desc_addr,
|
oct, oct->bootmem_desc_addr,
|
||||||
offsetof(struct cvmx_bootmem_desc, major_version),
|
offsetof(struct cvmx_bootmem_desc, major_version),
|
||||||
FIELD_SIZEOF(struct cvmx_bootmem_desc, major_version));
|
sizeof_field(struct cvmx_bootmem_desc, major_version));
|
||||||
minor_version = (u32)__cvmx_bootmem_desc_get(
|
minor_version = (u32)__cvmx_bootmem_desc_get(
|
||||||
oct, oct->bootmem_desc_addr,
|
oct, oct->bootmem_desc_addr,
|
||||||
offsetof(struct cvmx_bootmem_desc, minor_version),
|
offsetof(struct cvmx_bootmem_desc, minor_version),
|
||||||
FIELD_SIZEOF(struct cvmx_bootmem_desc, minor_version));
|
sizeof_field(struct cvmx_bootmem_desc, minor_version));
|
||||||
|
|
||||||
dev_dbg(&oct->pci_dev->dev, "%s: major_version=%d\n", __func__,
|
dev_dbg(&oct->pci_dev->dev, "%s: major_version=%d\n", __func__,
|
||||||
major_version);
|
major_version);
|
||||||
@ -237,13 +237,13 @@ static const struct cvmx_bootmem_named_block_desc
|
|||||||
oct, named_addr,
|
oct, named_addr,
|
||||||
offsetof(struct cvmx_bootmem_named_block_desc,
|
offsetof(struct cvmx_bootmem_named_block_desc,
|
||||||
base_addr),
|
base_addr),
|
||||||
FIELD_SIZEOF(
|
sizeof_field(
|
||||||
struct cvmx_bootmem_named_block_desc,
|
struct cvmx_bootmem_named_block_desc,
|
||||||
base_addr));
|
base_addr));
|
||||||
desc->size = __cvmx_bootmem_desc_get(oct, named_addr,
|
desc->size = __cvmx_bootmem_desc_get(oct, named_addr,
|
||||||
offsetof(struct cvmx_bootmem_named_block_desc,
|
offsetof(struct cvmx_bootmem_named_block_desc,
|
||||||
size),
|
size),
|
||||||
FIELD_SIZEOF(
|
sizeof_field(
|
||||||
struct cvmx_bootmem_named_block_desc,
|
struct cvmx_bootmem_named_block_desc,
|
||||||
size));
|
size));
|
||||||
|
|
||||||
@ -268,20 +268,20 @@ static u64 cvmx_bootmem_phy_named_block_find(struct octeon_device *oct,
|
|||||||
oct, oct->bootmem_desc_addr,
|
oct, oct->bootmem_desc_addr,
|
||||||
offsetof(struct cvmx_bootmem_desc,
|
offsetof(struct cvmx_bootmem_desc,
|
||||||
named_block_array_addr),
|
named_block_array_addr),
|
||||||
FIELD_SIZEOF(struct cvmx_bootmem_desc,
|
sizeof_field(struct cvmx_bootmem_desc,
|
||||||
named_block_array_addr));
|
named_block_array_addr));
|
||||||
u32 num_blocks = (u32)__cvmx_bootmem_desc_get(
|
u32 num_blocks = (u32)__cvmx_bootmem_desc_get(
|
||||||
oct, oct->bootmem_desc_addr,
|
oct, oct->bootmem_desc_addr,
|
||||||
offsetof(struct cvmx_bootmem_desc,
|
offsetof(struct cvmx_bootmem_desc,
|
||||||
nb_num_blocks),
|
nb_num_blocks),
|
||||||
FIELD_SIZEOF(struct cvmx_bootmem_desc,
|
sizeof_field(struct cvmx_bootmem_desc,
|
||||||
nb_num_blocks));
|
nb_num_blocks));
|
||||||
|
|
||||||
u32 name_length = (u32)__cvmx_bootmem_desc_get(
|
u32 name_length = (u32)__cvmx_bootmem_desc_get(
|
||||||
oct, oct->bootmem_desc_addr,
|
oct, oct->bootmem_desc_addr,
|
||||||
offsetof(struct cvmx_bootmem_desc,
|
offsetof(struct cvmx_bootmem_desc,
|
||||||
named_block_name_len),
|
named_block_name_len),
|
||||||
FIELD_SIZEOF(struct cvmx_bootmem_desc,
|
sizeof_field(struct cvmx_bootmem_desc,
|
||||||
named_block_name_len));
|
named_block_name_len));
|
||||||
|
|
||||||
u64 named_addr = named_block_array_addr;
|
u64 named_addr = named_block_array_addr;
|
||||||
@ -292,7 +292,7 @@ static u64 cvmx_bootmem_phy_named_block_find(struct octeon_device *oct,
|
|||||||
offsetof(
|
offsetof(
|
||||||
struct cvmx_bootmem_named_block_desc,
|
struct cvmx_bootmem_named_block_desc,
|
||||||
size),
|
size),
|
||||||
FIELD_SIZEOF(
|
sizeof_field(
|
||||||
struct cvmx_bootmem_named_block_desc,
|
struct cvmx_bootmem_named_block_desc,
|
||||||
size));
|
size));
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct be_ethtool_stat {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT};
|
enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT};
|
||||||
#define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
|
#define FIELDINFO(_struct, field) sizeof_field(_struct, field), \
|
||||||
offsetof(_struct, field)
|
offsetof(_struct, field)
|
||||||
#define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\
|
#define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\
|
||||||
FIELDINFO(struct be_tx_stats, field)
|
FIELDINFO(struct be_tx_stats, field)
|
||||||
|
@ -10240,7 +10240,7 @@ static int hclge_get_dfx_reg_len(struct hclge_dev *hdev, int *len)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
data_len_per_desc = FIELD_SIZEOF(struct hclge_desc, data);
|
data_len_per_desc = sizeof_field(struct hclge_desc, data);
|
||||||
*len = 0;
|
*len = 0;
|
||||||
for (i = 0; i < dfx_reg_type_num; i++) {
|
for (i = 0; i < dfx_reg_type_num; i++) {
|
||||||
bd_num = bd_num_list[i];
|
bd_num = bd_num_list[i];
|
||||||
|
@ -614,7 +614,7 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy(kinfo->prio_tc, hdev->tm_info.prio_tc,
|
memcpy(kinfo->prio_tc, hdev->tm_info.prio_tc,
|
||||||
FIELD_SIZEOF(struct hnae3_knic_private_info, prio_tc));
|
sizeof_field(struct hnae3_knic_private_info, prio_tc));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hclge_tm_vport_info_update(struct hclge_dev *hdev)
|
static void hclge_tm_vport_info_update(struct hclge_dev *hdev)
|
||||||
|
@ -450,7 +450,7 @@ static u32 hinic_get_rxfh_indir_size(struct net_device *netdev)
|
|||||||
|
|
||||||
#define HINIC_FUNC_STAT(_stat_item) { \
|
#define HINIC_FUNC_STAT(_stat_item) { \
|
||||||
.name = #_stat_item, \
|
.name = #_stat_item, \
|
||||||
.size = FIELD_SIZEOF(struct hinic_vport_stats, _stat_item), \
|
.size = sizeof_field(struct hinic_vport_stats, _stat_item), \
|
||||||
.offset = offsetof(struct hinic_vport_stats, _stat_item) \
|
.offset = offsetof(struct hinic_vport_stats, _stat_item) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ static struct hinic_stats hinic_function_stats[] = {
|
|||||||
|
|
||||||
#define HINIC_PORT_STAT(_stat_item) { \
|
#define HINIC_PORT_STAT(_stat_item) { \
|
||||||
.name = #_stat_item, \
|
.name = #_stat_item, \
|
||||||
.size = FIELD_SIZEOF(struct hinic_phy_port_stats, _stat_item), \
|
.size = sizeof_field(struct hinic_phy_port_stats, _stat_item), \
|
||||||
.offset = offsetof(struct hinic_phy_port_stats, _stat_item) \
|
.offset = offsetof(struct hinic_phy_port_stats, _stat_item) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ static struct hinic_stats hinic_port_stats[] = {
|
|||||||
|
|
||||||
#define HINIC_TXQ_STAT(_stat_item) { \
|
#define HINIC_TXQ_STAT(_stat_item) { \
|
||||||
.name = "txq%d_"#_stat_item, \
|
.name = "txq%d_"#_stat_item, \
|
||||||
.size = FIELD_SIZEOF(struct hinic_txq_stats, _stat_item), \
|
.size = sizeof_field(struct hinic_txq_stats, _stat_item), \
|
||||||
.offset = offsetof(struct hinic_txq_stats, _stat_item) \
|
.offset = offsetof(struct hinic_txq_stats, _stat_item) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +586,7 @@ static struct hinic_stats hinic_tx_queue_stats[] = {
|
|||||||
|
|
||||||
#define HINIC_RXQ_STAT(_stat_item) { \
|
#define HINIC_RXQ_STAT(_stat_item) { \
|
||||||
.name = "rxq%d_"#_stat_item, \
|
.name = "rxq%d_"#_stat_item, \
|
||||||
.size = FIELD_SIZEOF(struct hinic_rxq_stats, _stat_item), \
|
.size = sizeof_field(struct hinic_rxq_stats, _stat_item), \
|
||||||
.offset = offsetof(struct hinic_rxq_stats, _stat_item) \
|
.offset = offsetof(struct hinic_rxq_stats, _stat_item) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ struct fm10k_stats {
|
|||||||
|
|
||||||
#define FM10K_STAT_FIELDS(_type, _name, _stat) { \
|
#define FM10K_STAT_FIELDS(_type, _name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
|
.sizeof_stat = sizeof_field(_type, _stat), \
|
||||||
.stat_offset = offsetof(_type, _stat) \
|
.stat_offset = offsetof(_type, _stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ struct i40e_stats {
|
|||||||
*/
|
*/
|
||||||
#define I40E_STAT(_type, _name, _stat) { \
|
#define I40E_STAT(_type, _name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
|
.sizeof_stat = sizeof_field(_type, _stat), \
|
||||||
.stat_offset = offsetof(_type, _stat) \
|
.stat_offset = offsetof(_type, _stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ i40e_status i40e_shutdown_lan_hmc(struct i40e_hw *hw)
|
|||||||
|
|
||||||
#define I40E_HMC_STORE(_struct, _ele) \
|
#define I40E_HMC_STORE(_struct, _ele) \
|
||||||
offsetof(struct _struct, _ele), \
|
offsetof(struct _struct, _ele), \
|
||||||
FIELD_SIZEOF(struct _struct, _ele)
|
sizeof_field(struct _struct, _ele)
|
||||||
|
|
||||||
struct i40e_context_ele {
|
struct i40e_context_ele {
|
||||||
u16 offset;
|
u16 offset;
|
||||||
|
@ -42,7 +42,7 @@ struct iavf_stats {
|
|||||||
*/
|
*/
|
||||||
#define IAVF_STAT(_type, _name, _stat) { \
|
#define IAVF_STAT(_type, _name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
|
.sizeof_stat = sizeof_field(_type, _stat), \
|
||||||
.stat_offset = offsetof(_type, _stat) \
|
.stat_offset = offsetof(_type, _stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ struct ice_stats {
|
|||||||
|
|
||||||
#define ICE_STAT(_type, _name, _stat) { \
|
#define ICE_STAT(_type, _name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
|
.sizeof_stat = sizeof_field(_type, _stat), \
|
||||||
.stat_offset = offsetof(_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_VSI_STATS_LEN ARRAY_SIZE(ice_gstrings_vsi_stats)
|
||||||
|
|
||||||
#define ICE_PFC_STATS_LEN ( \
|
#define ICE_PFC_STATS_LEN ( \
|
||||||
(FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_rx) + \
|
(sizeof_field(struct ice_pf, stats.priority_xoff_rx) + \
|
||||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xon_rx) + \
|
sizeof_field(struct ice_pf, stats.priority_xon_rx) + \
|
||||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_tx) + \
|
sizeof_field(struct ice_pf, stats.priority_xoff_tx) + \
|
||||||
FIELD_SIZEOF(struct ice_pf, stats.priority_xon_tx)) \
|
sizeof_field(struct ice_pf, stats.priority_xon_tx)) \
|
||||||
/ sizeof(u64))
|
/ sizeof(u64))
|
||||||
#define ICE_ALL_STATS_LEN(n) (ICE_PF_STATS_LEN + ICE_PFC_STATS_LEN + \
|
#define ICE_ALL_STATS_LEN(n) (ICE_PF_STATS_LEN + ICE_PFC_STATS_LEN + \
|
||||||
ICE_VSI_STATS_LEN + ice_q_stats_len(n))
|
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) { \
|
#define ICE_CTX_STORE(_struct, _ele, _width, _lsb) { \
|
||||||
.offset = offsetof(struct _struct, _ele), \
|
.offset = offsetof(struct _struct, _ele), \
|
||||||
.size_of = FIELD_SIZEOF(struct _struct, _ele), \
|
.size_of = sizeof_field(struct _struct, _ele), \
|
||||||
.width = _width, \
|
.width = _width, \
|
||||||
.lsb = _lsb, \
|
.lsb = _lsb, \
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ struct igb_stats {
|
|||||||
|
|
||||||
#define IGB_STAT(_name, _stat) { \
|
#define IGB_STAT(_name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct igb_adapter, _stat), \
|
.sizeof_stat = sizeof_field(struct igb_adapter, _stat), \
|
||||||
.stat_offset = offsetof(struct igb_adapter, _stat) \
|
.stat_offset = offsetof(struct igb_adapter, _stat) \
|
||||||
}
|
}
|
||||||
static const struct igb_stats igb_gstrings_stats[] = {
|
static const struct igb_stats igb_gstrings_stats[] = {
|
||||||
@ -76,7 +76,7 @@ static const struct igb_stats igb_gstrings_stats[] = {
|
|||||||
|
|
||||||
#define IGB_NETDEV_STAT(_net_stat) { \
|
#define IGB_NETDEV_STAT(_net_stat) { \
|
||||||
.stat_string = __stringify(_net_stat), \
|
.stat_string = __stringify(_net_stat), \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct rtnl_link_stats64, _net_stat), \
|
.sizeof_stat = sizeof_field(struct rtnl_link_stats64, _net_stat), \
|
||||||
.stat_offset = offsetof(struct rtnl_link_stats64, _net_stat) \
|
.stat_offset = offsetof(struct rtnl_link_stats64, _net_stat) \
|
||||||
}
|
}
|
||||||
static const struct igb_stats igb_gstrings_net_stats[] = {
|
static const struct igb_stats igb_gstrings_net_stats[] = {
|
||||||
|
@ -16,7 +16,7 @@ struct igc_stats {
|
|||||||
|
|
||||||
#define IGC_STAT(_name, _stat) { \
|
#define IGC_STAT(_name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct igc_adapter, _stat), \
|
.sizeof_stat = sizeof_field(struct igc_adapter, _stat), \
|
||||||
.stat_offset = offsetof(struct igc_adapter, _stat) \
|
.stat_offset = offsetof(struct igc_adapter, _stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ static const struct igc_stats igc_gstrings_stats[] = {
|
|||||||
|
|
||||||
#define IGC_NETDEV_STAT(_net_stat) { \
|
#define IGC_NETDEV_STAT(_net_stat) { \
|
||||||
.stat_string = __stringify(_net_stat), \
|
.stat_string = __stringify(_net_stat), \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct rtnl_link_stats64, _net_stat), \
|
.sizeof_stat = sizeof_field(struct rtnl_link_stats64, _net_stat), \
|
||||||
.stat_offset = offsetof(struct rtnl_link_stats64, _net_stat) \
|
.stat_offset = offsetof(struct rtnl_link_stats64, _net_stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ struct ixgb_stats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define IXGB_STAT(m) IXGB_STATS, \
|
#define IXGB_STAT(m) IXGB_STATS, \
|
||||||
FIELD_SIZEOF(struct ixgb_adapter, m), \
|
sizeof_field(struct ixgb_adapter, m), \
|
||||||
offsetof(struct ixgb_adapter, m)
|
offsetof(struct ixgb_adapter, m)
|
||||||
#define IXGB_NETDEV_STAT(m) NETDEV_STATS, \
|
#define IXGB_NETDEV_STAT(m) NETDEV_STATS, \
|
||||||
FIELD_SIZEOF(struct net_device, m), \
|
sizeof_field(struct net_device, m), \
|
||||||
offsetof(struct net_device, m)
|
offsetof(struct net_device, m)
|
||||||
|
|
||||||
static struct ixgb_stats ixgb_gstrings_stats[] = {
|
static struct ixgb_stats ixgb_gstrings_stats[] = {
|
||||||
|
@ -31,14 +31,14 @@ struct ixgbe_stats {
|
|||||||
#define IXGBEVF_STAT(_name, _stat) { \
|
#define IXGBEVF_STAT(_name, _stat) { \
|
||||||
.stat_string = _name, \
|
.stat_string = _name, \
|
||||||
.type = IXGBEVF_STATS, \
|
.type = IXGBEVF_STATS, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct ixgbevf_adapter, _stat), \
|
.sizeof_stat = sizeof_field(struct ixgbevf_adapter, _stat), \
|
||||||
.stat_offset = offsetof(struct ixgbevf_adapter, _stat) \
|
.stat_offset = offsetof(struct ixgbevf_adapter, _stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IXGBEVF_NETDEV_STAT(_net_stat) { \
|
#define IXGBEVF_NETDEV_STAT(_net_stat) { \
|
||||||
.stat_string = #_net_stat, \
|
.stat_string = #_net_stat, \
|
||||||
.type = NETDEV_STATS, \
|
.type = NETDEV_STATS, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct net_device_stats, _net_stat), \
|
.sizeof_stat = sizeof_field(struct net_device_stats, _net_stat), \
|
||||||
.stat_offset = offsetof(struct net_device_stats, _net_stat) \
|
.stat_offset = offsetof(struct net_device_stats, _net_stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,11 +1432,11 @@ struct mv643xx_eth_stats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define SSTAT(m) \
|
#define SSTAT(m) \
|
||||||
{ #m, FIELD_SIZEOF(struct net_device_stats, m), \
|
{ #m, sizeof_field(struct net_device_stats, m), \
|
||||||
offsetof(struct net_device, stats.m), -1 }
|
offsetof(struct net_device, stats.m), -1 }
|
||||||
|
|
||||||
#define MIBSTAT(m) \
|
#define MIBSTAT(m) \
|
||||||
{ #m, FIELD_SIZEOF(struct mib_counters, m), \
|
{ #m, sizeof_field(struct mib_counters, m), \
|
||||||
-1, offsetof(struct mv643xx_eth_private, mib_counters.m) }
|
-1, offsetof(struct mv643xx_eth_private, mib_counters.m) }
|
||||||
|
|
||||||
static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
|
static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
|
||||||
|
@ -611,7 +611,7 @@ static u32 ptys_get_active_port(struct mlx4_ptys_reg *ptys_reg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define MLX4_LINK_MODES_SZ \
|
#define MLX4_LINK_MODES_SZ \
|
||||||
(FIELD_SIZEOF(struct mlx4_ptys_reg, eth_proto_cap) * 8)
|
(sizeof_field(struct mlx4_ptys_reg, eth_proto_cap) * 8)
|
||||||
|
|
||||||
enum ethtool_report {
|
enum ethtool_report {
|
||||||
SUPPORTED = 0,
|
SUPPORTED = 0,
|
||||||
|
@ -87,10 +87,10 @@ static const struct rhashtable_params rhash_sa = {
|
|||||||
* value is not constant during the lifetime
|
* value is not constant during the lifetime
|
||||||
* of the key object.
|
* of the key object.
|
||||||
*/
|
*/
|
||||||
.key_len = FIELD_SIZEOF(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) -
|
.key_len = sizeof_field(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) -
|
||||||
FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd),
|
sizeof_field(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd),
|
||||||
.key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) +
|
.key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) +
|
||||||
FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd),
|
sizeof_field(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd),
|
||||||
.head_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hash),
|
.head_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hash),
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
.min_size = 1,
|
.min_size = 1,
|
||||||
|
@ -209,7 +209,7 @@ enum fs_i_lock_class {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct rhashtable_params rhash_fte = {
|
static const struct rhashtable_params rhash_fte = {
|
||||||
.key_len = FIELD_SIZEOF(struct fs_fte, val),
|
.key_len = sizeof_field(struct fs_fte, val),
|
||||||
.key_offset = offsetof(struct fs_fte, val),
|
.key_offset = offsetof(struct fs_fte, val),
|
||||||
.head_offset = offsetof(struct fs_fte, hash),
|
.head_offset = offsetof(struct fs_fte, hash),
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
@ -217,7 +217,7 @@ static const struct rhashtable_params rhash_fte = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct rhashtable_params rhash_fg = {
|
static const struct rhashtable_params rhash_fg = {
|
||||||
.key_len = FIELD_SIZEOF(struct mlx5_flow_group, mask),
|
.key_len = sizeof_field(struct mlx5_flow_group, mask),
|
||||||
.key_offset = offsetof(struct mlx5_flow_group, mask),
|
.key_offset = offsetof(struct mlx5_flow_group, mask),
|
||||||
.head_offset = offsetof(struct mlx5_flow_group, hash),
|
.head_offset = offsetof(struct mlx5_flow_group, hash),
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
|
@ -2652,17 +2652,17 @@ static int mem_ldx_skb(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,
|
|||||||
|
|
||||||
switch (meta->insn.off) {
|
switch (meta->insn.off) {
|
||||||
case offsetof(struct __sk_buff, len):
|
case offsetof(struct __sk_buff, len):
|
||||||
if (size != FIELD_SIZEOF(struct __sk_buff, len))
|
if (size != sizeof_field(struct __sk_buff, len))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
wrp_mov(nfp_prog, dst, plen_reg(nfp_prog));
|
wrp_mov(nfp_prog, dst, plen_reg(nfp_prog));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, data):
|
case offsetof(struct __sk_buff, data):
|
||||||
if (size != FIELD_SIZEOF(struct __sk_buff, data))
|
if (size != sizeof_field(struct __sk_buff, data))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
wrp_mov(nfp_prog, dst, pptr_reg(nfp_prog));
|
wrp_mov(nfp_prog, dst, pptr_reg(nfp_prog));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, data_end):
|
case offsetof(struct __sk_buff, data_end):
|
||||||
if (size != FIELD_SIZEOF(struct __sk_buff, data_end))
|
if (size != sizeof_field(struct __sk_buff, data_end))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
emit_alu(nfp_prog, dst,
|
emit_alu(nfp_prog, dst,
|
||||||
plen_reg(nfp_prog), ALU_OP_ADD, pptr_reg(nfp_prog));
|
plen_reg(nfp_prog), ALU_OP_ADD, pptr_reg(nfp_prog));
|
||||||
@ -2683,12 +2683,12 @@ static int mem_ldx_xdp(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,
|
|||||||
|
|
||||||
switch (meta->insn.off) {
|
switch (meta->insn.off) {
|
||||||
case offsetof(struct xdp_md, data):
|
case offsetof(struct xdp_md, data):
|
||||||
if (size != FIELD_SIZEOF(struct xdp_md, data))
|
if (size != sizeof_field(struct xdp_md, data))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
wrp_mov(nfp_prog, dst, pptr_reg(nfp_prog));
|
wrp_mov(nfp_prog, dst, pptr_reg(nfp_prog));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct xdp_md, data_end):
|
case offsetof(struct xdp_md, data_end):
|
||||||
if (size != FIELD_SIZEOF(struct xdp_md, data_end))
|
if (size != sizeof_field(struct xdp_md, data_end))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
emit_alu(nfp_prog, dst,
|
emit_alu(nfp_prog, dst,
|
||||||
plen_reg(nfp_prog), ALU_OP_ADD, pptr_reg(nfp_prog));
|
plen_reg(nfp_prog), ALU_OP_ADD, pptr_reg(nfp_prog));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
const struct rhashtable_params nfp_bpf_maps_neutral_params = {
|
const struct rhashtable_params nfp_bpf_maps_neutral_params = {
|
||||||
.nelem_hint = 4,
|
.nelem_hint = 4,
|
||||||
.key_len = FIELD_SIZEOF(struct bpf_map, id),
|
.key_len = sizeof_field(struct bpf_map, id),
|
||||||
.key_offset = offsetof(struct nfp_bpf_neutral_map, map_id),
|
.key_offset = offsetof(struct nfp_bpf_neutral_map, map_id),
|
||||||
.head_offset = offsetof(struct nfp_bpf_neutral_map, l),
|
.head_offset = offsetof(struct nfp_bpf_neutral_map, l),
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
|
@ -374,7 +374,7 @@ nfp_bpf_map_alloc(struct nfp_app_bpf *bpf, struct bpf_offloaded_map *offmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
use_map_size = DIV_ROUND_UP(offmap->map.value_size, 4) *
|
use_map_size = DIV_ROUND_UP(offmap->map.value_size, 4) *
|
||||||
FIELD_SIZEOF(struct nfp_bpf_map, use_map[0]);
|
sizeof_field(struct nfp_bpf_map, use_map[0]);
|
||||||
|
|
||||||
nfp_map = kzalloc(sizeof(*nfp_map) + use_map_size, GFP_USER);
|
nfp_map = kzalloc(sizeof(*nfp_map) + use_map_size, GFP_USER);
|
||||||
if (!nfp_map)
|
if (!nfp_map)
|
||||||
|
@ -24,7 +24,7 @@ struct nfp_app;
|
|||||||
#define NFP_FL_STAT_ID_MU_NUM GENMASK(31, 22)
|
#define NFP_FL_STAT_ID_MU_NUM GENMASK(31, 22)
|
||||||
#define NFP_FL_STAT_ID_STAT GENMASK(21, 0)
|
#define NFP_FL_STAT_ID_STAT GENMASK(21, 0)
|
||||||
|
|
||||||
#define NFP_FL_STATS_ELEM_RS FIELD_SIZEOF(struct nfp_fl_stats_id, \
|
#define NFP_FL_STATS_ELEM_RS sizeof_field(struct nfp_fl_stats_id, \
|
||||||
init_unalloc)
|
init_unalloc)
|
||||||
#define NFP_FLOWER_MASK_ENTRY_RS 256
|
#define NFP_FLOWER_MASK_ENTRY_RS 256
|
||||||
#define NFP_FLOWER_MASK_ELEMENT_RS 1
|
#define NFP_FLOWER_MASK_ELEMENT_RS 1
|
||||||
|
@ -20,7 +20,7 @@ struct pch_gbe_stats {
|
|||||||
#define PCH_GBE_STAT(m) \
|
#define PCH_GBE_STAT(m) \
|
||||||
{ \
|
{ \
|
||||||
.string = #m, \
|
.string = #m, \
|
||||||
.size = FIELD_SIZEOF(struct pch_gbe_hw_stats, m), \
|
.size = sizeof_field(struct pch_gbe_hw_stats, m), \
|
||||||
.offset = offsetof(struct pch_gbe_hw_stats, m), \
|
.offset = offsetof(struct pch_gbe_hw_stats, m), \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ struct qede_fastpath {
|
|||||||
struct qede_tx_queue *txq;
|
struct qede_tx_queue *txq;
|
||||||
struct qede_tx_queue *xdp_tx;
|
struct qede_tx_queue *xdp_tx;
|
||||||
|
|
||||||
#define VEC_NAME_SIZE (FIELD_SIZEOF(struct net_device, name) + 8)
|
#define VEC_NAME_SIZE (sizeof_field(struct net_device, name) + 8)
|
||||||
char name[VEC_NAME_SIZE];
|
char name[VEC_NAME_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ struct qlcnic_stats {
|
|||||||
int stat_offset;
|
int stat_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QLC_SIZEOF(m) FIELD_SIZEOF(struct qlcnic_adapter, m)
|
#define QLC_SIZEOF(m) sizeof_field(struct qlcnic_adapter, m)
|
||||||
#define QLC_OFF(m) offsetof(struct qlcnic_adapter, m)
|
#define QLC_OFF(m) offsetof(struct qlcnic_adapter, m)
|
||||||
static const u32 qlcnic_fw_dump_level[] = {
|
static const u32 qlcnic_fw_dump_level[] = {
|
||||||
0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff
|
0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff
|
||||||
|
@ -37,7 +37,7 @@ struct fw_info {
|
|||||||
u8 chksum;
|
u8 chksum;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
#define FW_OPCODE_SIZE FIELD_SIZEOF(struct rtl_fw_phy_action, code[0])
|
#define FW_OPCODE_SIZE sizeof_field(struct rtl_fw_phy_action, code[0])
|
||||||
|
|
||||||
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
|
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ struct sxgbe_stats {
|
|||||||
#define SXGBE_STAT(m) \
|
#define SXGBE_STAT(m) \
|
||||||
{ \
|
{ \
|
||||||
#m, \
|
#m, \
|
||||||
FIELD_SIZEOF(struct sxgbe_extra_stats, m), \
|
sizeof_field(struct sxgbe_extra_stats, m), \
|
||||||
offsetof(struct sxgbe_priv_data, xstats.m) \
|
offsetof(struct sxgbe_priv_data, xstats.m) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ struct stmmac_stats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define STMMAC_STAT(m) \
|
#define STMMAC_STAT(m) \
|
||||||
{ #m, FIELD_SIZEOF(struct stmmac_extra_stats, m), \
|
{ #m, sizeof_field(struct stmmac_extra_stats, m), \
|
||||||
offsetof(struct stmmac_priv, xstats.m)}
|
offsetof(struct stmmac_priv, xstats.m)}
|
||||||
|
|
||||||
static const struct stmmac_stats stmmac_gstrings_stats[] = {
|
static const struct stmmac_stats stmmac_gstrings_stats[] = {
|
||||||
@ -163,7 +163,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
|
|||||||
|
|
||||||
/* HW MAC Management counters (if supported) */
|
/* HW MAC Management counters (if supported) */
|
||||||
#define STMMAC_MMC_STAT(m) \
|
#define STMMAC_MMC_STAT(m) \
|
||||||
{ #m, FIELD_SIZEOF(struct stmmac_counters, m), \
|
{ #m, sizeof_field(struct stmmac_counters, m), \
|
||||||
offsetof(struct stmmac_priv, mmc.m)}
|
offsetof(struct stmmac_priv, mmc.m)}
|
||||||
|
|
||||||
static const struct stmmac_stats stmmac_mmc[] = {
|
static const struct stmmac_stats stmmac_mmc[] = {
|
||||||
|
@ -73,13 +73,13 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define CPSW_STAT(m) CPSW_STATS, \
|
#define CPSW_STAT(m) CPSW_STATS, \
|
||||||
FIELD_SIZEOF(struct cpsw_hw_stats, m), \
|
sizeof_field(struct cpsw_hw_stats, m), \
|
||||||
offsetof(struct cpsw_hw_stats, m)
|
offsetof(struct cpsw_hw_stats, m)
|
||||||
#define CPDMA_RX_STAT(m) CPDMA_RX_STATS, \
|
#define CPDMA_RX_STAT(m) CPDMA_RX_STATS, \
|
||||||
FIELD_SIZEOF(struct cpdma_chan_stats, m), \
|
sizeof_field(struct cpdma_chan_stats, m), \
|
||||||
offsetof(struct cpdma_chan_stats, m)
|
offsetof(struct cpdma_chan_stats, m)
|
||||||
#define CPDMA_TX_STAT(m) CPDMA_TX_STATS, \
|
#define CPDMA_TX_STAT(m) CPDMA_TX_STATS, \
|
||||||
FIELD_SIZEOF(struct cpdma_chan_stats, m), \
|
sizeof_field(struct cpdma_chan_stats, m), \
|
||||||
offsetof(struct cpdma_chan_stats, m)
|
offsetof(struct cpdma_chan_stats, m)
|
||||||
|
|
||||||
static const struct cpsw_stats cpsw_gstrings_stats[] = {
|
static const struct cpsw_stats cpsw_gstrings_stats[] = {
|
||||||
|
@ -783,28 +783,28 @@ struct netcp_ethtool_stat {
|
|||||||
#define GBE_STATSA_INFO(field) \
|
#define GBE_STATSA_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_A:"#field, GBE_STATSA_MODULE, \
|
"GBE_A:"#field, GBE_STATSA_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbe_hw_stats, field), \
|
sizeof_field(struct gbe_hw_stats, field), \
|
||||||
offsetof(struct gbe_hw_stats, field) \
|
offsetof(struct gbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBE_STATSB_INFO(field) \
|
#define GBE_STATSB_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_B:"#field, GBE_STATSB_MODULE, \
|
"GBE_B:"#field, GBE_STATSB_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbe_hw_stats, field), \
|
sizeof_field(struct gbe_hw_stats, field), \
|
||||||
offsetof(struct gbe_hw_stats, field) \
|
offsetof(struct gbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBE_STATSC_INFO(field) \
|
#define GBE_STATSC_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_C:"#field, GBE_STATSC_MODULE, \
|
"GBE_C:"#field, GBE_STATSC_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbe_hw_stats, field), \
|
sizeof_field(struct gbe_hw_stats, field), \
|
||||||
offsetof(struct gbe_hw_stats, field) \
|
offsetof(struct gbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBE_STATSD_INFO(field) \
|
#define GBE_STATSD_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_D:"#field, GBE_STATSD_MODULE, \
|
"GBE_D:"#field, GBE_STATSD_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbe_hw_stats, field), \
|
sizeof_field(struct gbe_hw_stats, field), \
|
||||||
offsetof(struct gbe_hw_stats, field) \
|
offsetof(struct gbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,7 +957,7 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = {
|
|||||||
#define GBENU_STATS_HOST(field) \
|
#define GBENU_STATS_HOST(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_HOST:"#field, GBENU_STATS0_MODULE, \
|
"GBE_HOST:"#field, GBENU_STATS0_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -967,56 +967,56 @@ static const struct netcp_ethtool_stat gbe13_et_stats[] = {
|
|||||||
#define GBENU_STATS_P1(field) \
|
#define GBENU_STATS_P1(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P1:"#field, GBENU_STATS1_MODULE, \
|
"GBE_P1:"#field, GBENU_STATS1_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P2(field) \
|
#define GBENU_STATS_P2(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P2:"#field, GBENU_STATS2_MODULE, \
|
"GBE_P2:"#field, GBENU_STATS2_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P3(field) \
|
#define GBENU_STATS_P3(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P3:"#field, GBENU_STATS3_MODULE, \
|
"GBE_P3:"#field, GBENU_STATS3_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P4(field) \
|
#define GBENU_STATS_P4(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P4:"#field, GBENU_STATS4_MODULE, \
|
"GBE_P4:"#field, GBENU_STATS4_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P5(field) \
|
#define GBENU_STATS_P5(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P5:"#field, GBENU_STATS5_MODULE, \
|
"GBE_P5:"#field, GBENU_STATS5_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P6(field) \
|
#define GBENU_STATS_P6(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P6:"#field, GBENU_STATS6_MODULE, \
|
"GBE_P6:"#field, GBENU_STATS6_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P7(field) \
|
#define GBENU_STATS_P7(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P7:"#field, GBENU_STATS7_MODULE, \
|
"GBE_P7:"#field, GBENU_STATS7_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GBENU_STATS_P8(field) \
|
#define GBENU_STATS_P8(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_P8:"#field, GBENU_STATS8_MODULE, \
|
"GBE_P8:"#field, GBENU_STATS8_MODULE, \
|
||||||
FIELD_SIZEOF(struct gbenu_hw_stats, field), \
|
sizeof_field(struct gbenu_hw_stats, field), \
|
||||||
offsetof(struct gbenu_hw_stats, field) \
|
offsetof(struct gbenu_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1607,21 +1607,21 @@ static const struct netcp_ethtool_stat gbenu_et_stats[] = {
|
|||||||
#define XGBE_STATS0_INFO(field) \
|
#define XGBE_STATS0_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_0:"#field, XGBE_STATS0_MODULE, \
|
"GBE_0:"#field, XGBE_STATS0_MODULE, \
|
||||||
FIELD_SIZEOF(struct xgbe_hw_stats, field), \
|
sizeof_field(struct xgbe_hw_stats, field), \
|
||||||
offsetof(struct xgbe_hw_stats, field) \
|
offsetof(struct xgbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XGBE_STATS1_INFO(field) \
|
#define XGBE_STATS1_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_1:"#field, XGBE_STATS1_MODULE, \
|
"GBE_1:"#field, XGBE_STATS1_MODULE, \
|
||||||
FIELD_SIZEOF(struct xgbe_hw_stats, field), \
|
sizeof_field(struct xgbe_hw_stats, field), \
|
||||||
offsetof(struct xgbe_hw_stats, field) \
|
offsetof(struct xgbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XGBE_STATS2_INFO(field) \
|
#define XGBE_STATS2_INFO(field) \
|
||||||
{ \
|
{ \
|
||||||
"GBE_2:"#field, XGBE_STATS2_MODULE, \
|
"GBE_2:"#field, XGBE_STATS2_MODULE, \
|
||||||
FIELD_SIZEOF(struct xgbe_hw_stats, field), \
|
sizeof_field(struct xgbe_hw_stats, field), \
|
||||||
offsetof(struct xgbe_hw_stats, field) \
|
offsetof(struct xgbe_hw_stats, field) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ struct fjes_stats {
|
|||||||
|
|
||||||
#define FJES_STAT(name, stat) { \
|
#define FJES_STAT(name, stat) { \
|
||||||
.stat_string = name, \
|
.stat_string = name, \
|
||||||
.sizeof_stat = FIELD_SIZEOF(struct fjes_adapter, stat), \
|
.sizeof_stat = sizeof_field(struct fjes_adapter, stat), \
|
||||||
.stat_offset = offsetof(struct fjes_adapter, stat) \
|
.stat_offset = offsetof(struct fjes_adapter, stat) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,7 +1156,7 @@ static void geneve_setup(struct net_device *dev)
|
|||||||
|
|
||||||
static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX + 1] = {
|
static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX + 1] = {
|
||||||
[IFLA_GENEVE_ID] = { .type = NLA_U32 },
|
[IFLA_GENEVE_ID] = { .type = NLA_U32 },
|
||||||
[IFLA_GENEVE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
[IFLA_GENEVE_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) },
|
||||||
[IFLA_GENEVE_REMOTE6] = { .len = sizeof(struct in6_addr) },
|
[IFLA_GENEVE_REMOTE6] = { .len = sizeof(struct in6_addr) },
|
||||||
[IFLA_GENEVE_TTL] = { .type = NLA_U8 },
|
[IFLA_GENEVE_TTL] = { .type = NLA_U8 },
|
||||||
[IFLA_GENEVE_TOS] = { .type = NLA_U8 },
|
[IFLA_GENEVE_TOS] = { .type = NLA_U8 },
|
||||||
|
@ -571,7 +571,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
|
|||||||
|
|
||||||
/* Use the skb control buffer for building up the packet */
|
/* Use the skb control buffer for building up the packet */
|
||||||
BUILD_BUG_ON(sizeof(struct hv_netvsc_packet) >
|
BUILD_BUG_ON(sizeof(struct hv_netvsc_packet) >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb));
|
sizeof_field(struct sk_buff, cb));
|
||||||
packet = (struct hv_netvsc_packet *)skb->cb;
|
packet = (struct hv_netvsc_packet *)skb->cb;
|
||||||
|
|
||||||
packet->q_idx = skb_get_queue_mapping(skb);
|
packet->q_idx = skb_get_queue_mapping(skb);
|
||||||
|
@ -865,7 +865,7 @@ static struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev,
|
|||||||
u16 len;
|
u16 len;
|
||||||
bool need_tail;
|
bool need_tail;
|
||||||
|
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data)
|
BUILD_BUG_ON(sizeof_field(struct usbnet, data)
|
||||||
< sizeof(struct cdc_state));
|
< sizeof(struct cdc_state));
|
||||||
|
|
||||||
dev_dbg(&dev->udev->dev, "%s", __func__);
|
dev_dbg(&dev->udev->dev, "%s", __func__);
|
||||||
|
@ -2184,7 +2184,7 @@ static int __init usbnet_init(void)
|
|||||||
{
|
{
|
||||||
/* Compiler should optimize this out. */
|
/* Compiler should optimize this out. */
|
||||||
BUILD_BUG_ON(
|
BUILD_BUG_ON(
|
||||||
FIELD_SIZEOF(struct sk_buff, cb) < sizeof(struct skb_data));
|
sizeof_field(struct sk_buff, cb) < sizeof(struct skb_data));
|
||||||
|
|
||||||
eth_random_addr(node_id);
|
eth_random_addr(node_id);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3069,10 +3069,10 @@ static void vxlan_raw_setup(struct net_device *dev)
|
|||||||
|
|
||||||
static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {
|
static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {
|
||||||
[IFLA_VXLAN_ID] = { .type = NLA_U32 },
|
[IFLA_VXLAN_ID] = { .type = NLA_U32 },
|
||||||
[IFLA_VXLAN_GROUP] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
[IFLA_VXLAN_GROUP] = { .len = sizeof_field(struct iphdr, daddr) },
|
||||||
[IFLA_VXLAN_GROUP6] = { .len = sizeof(struct in6_addr) },
|
[IFLA_VXLAN_GROUP6] = { .len = sizeof(struct in6_addr) },
|
||||||
[IFLA_VXLAN_LINK] = { .type = NLA_U32 },
|
[IFLA_VXLAN_LINK] = { .type = NLA_U32 },
|
||||||
[IFLA_VXLAN_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) },
|
[IFLA_VXLAN_LOCAL] = { .len = sizeof_field(struct iphdr, saddr) },
|
||||||
[IFLA_VXLAN_LOCAL6] = { .len = sizeof(struct in6_addr) },
|
[IFLA_VXLAN_LOCAL6] = { .len = sizeof(struct in6_addr) },
|
||||||
[IFLA_VXLAN_TOS] = { .type = NLA_U8 },
|
[IFLA_VXLAN_TOS] = { .type = NLA_U8 },
|
||||||
[IFLA_VXLAN_TTL] = { .type = NLA_U8 },
|
[IFLA_VXLAN_TTL] = { .type = NLA_U8 },
|
||||||
|
@ -774,7 +774,7 @@ void lbs_debugfs_remove_one(struct lbs_private *priv)
|
|||||||
|
|
||||||
#ifdef PROC_DEBUG
|
#ifdef PROC_DEBUG
|
||||||
|
|
||||||
#define item_size(n) (FIELD_SIZEOF(struct lbs_private, n))
|
#define item_size(n) (sizeof_field(struct lbs_private, n))
|
||||||
#define item_addr(n) (offsetof(struct lbs_private, n))
|
#define item_addr(n) (offsetof(struct lbs_private, n))
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ struct mwifiex_cb {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* size/addr for mwifiex_debug_info */
|
/* size/addr for mwifiex_debug_info */
|
||||||
#define item_size(n) (FIELD_SIZEOF(struct mwifiex_debug_info, n))
|
#define item_size(n) (sizeof_field(struct mwifiex_debug_info, n))
|
||||||
#define item_addr(n) (offsetof(struct mwifiex_debug_info, n))
|
#define item_addr(n) (offsetof(struct mwifiex_debug_info, n))
|
||||||
|
|
||||||
/* size/addr for struct mwifiex_adapter */
|
/* size/addr for struct mwifiex_adapter */
|
||||||
#define adapter_item_size(n) (FIELD_SIZEOF(struct mwifiex_adapter, n))
|
#define adapter_item_size(n) (sizeof_field(struct mwifiex_adapter, n))
|
||||||
#define adapter_item_addr(n) (offsetof(struct mwifiex_adapter, n))
|
#define adapter_item_addr(n) (offsetof(struct mwifiex_adapter, n))
|
||||||
|
|
||||||
struct mwifiex_debug_data {
|
struct mwifiex_debug_data {
|
||||||
|
@ -4779,7 +4779,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
|
|||||||
|
|
||||||
QETH_CARD_TEXT(card, 2, "qdioest");
|
QETH_CARD_TEXT(card, 2, "qdioest");
|
||||||
|
|
||||||
qib_param_field = kzalloc(FIELD_SIZEOF(struct qib, parm), GFP_KERNEL);
|
qib_param_field = kzalloc(sizeof_field(struct qib, parm), GFP_KERNEL);
|
||||||
if (!qib_param_field) {
|
if (!qib_param_field) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out_free_nothing;
|
goto out_free_nothing;
|
||||||
|
@ -421,7 +421,7 @@ struct qeth_ipacmd_setassparms {
|
|||||||
} data;
|
} data;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define SETASS_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipacmd_setassparms,\
|
#define SETASS_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setassparms,\
|
||||||
data.field)
|
data.field)
|
||||||
|
|
||||||
/* SETRTG IPA Command: ****************************************************/
|
/* SETRTG IPA Command: ****************************************************/
|
||||||
@ -535,7 +535,7 @@ struct qeth_ipacmd_setadpparms {
|
|||||||
} data;
|
} data;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define SETADP_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipacmd_setadpparms,\
|
#define SETADP_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setadpparms,\
|
||||||
data.field)
|
data.field)
|
||||||
|
|
||||||
/* CREATE_ADDR IPA Command: ***********************************************/
|
/* CREATE_ADDR IPA Command: ***********************************************/
|
||||||
@ -648,7 +648,7 @@ struct qeth_ipacmd_vnicc {
|
|||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VNICC_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipacmd_vnicc,\
|
#define VNICC_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_vnicc,\
|
||||||
data.field)
|
data.field)
|
||||||
|
|
||||||
/* SETBRIDGEPORT IPA Command: *********************************************/
|
/* SETBRIDGEPORT IPA Command: *********************************************/
|
||||||
@ -729,7 +729,7 @@ struct qeth_ipacmd_setbridgeport {
|
|||||||
} data;
|
} data;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
#define SBP_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipacmd_setbridgeport,\
|
#define SBP_DATA_SIZEOF(field) sizeof_field(struct qeth_ipacmd_setbridgeport,\
|
||||||
data.field)
|
data.field)
|
||||||
|
|
||||||
/* ADDRESS_CHANGE_NOTIFICATION adapter-initiated "command" *******************/
|
/* ADDRESS_CHANGE_NOTIFICATION adapter-initiated "command" *******************/
|
||||||
@ -790,7 +790,7 @@ struct qeth_ipa_cmd {
|
|||||||
} data;
|
} data;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define IPA_DATA_SIZEOF(field) FIELD_SIZEOF(struct qeth_ipa_cmd, data.field)
|
#define IPA_DATA_SIZEOF(field) sizeof_field(struct qeth_ipa_cmd, data.field)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* special command for ARP processing.
|
* special command for ARP processing.
|
||||||
|
@ -535,7 +535,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
|
|||||||
if ((le32_to_cpu(get_name_reply->status) == CT_OK)
|
if ((le32_to_cpu(get_name_reply->status) == CT_OK)
|
||||||
&& (get_name_reply->data[0] != '\0')) {
|
&& (get_name_reply->data[0] != '\0')) {
|
||||||
char *sp = get_name_reply->data;
|
char *sp = get_name_reply->data;
|
||||||
int data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
|
int data_size = sizeof_field(struct aac_get_name_resp, data);
|
||||||
|
|
||||||
sp[data_size - 1] = '\0';
|
sp[data_size - 1] = '\0';
|
||||||
while (*sp == ' ')
|
while (*sp == ' ')
|
||||||
@ -574,7 +574,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
|
|||||||
|
|
||||||
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
|
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
|
||||||
|
|
||||||
data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
|
data_size = sizeof_field(struct aac_get_name_resp, data);
|
||||||
|
|
||||||
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
|
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
|
||||||
|
|
||||||
|
@ -1300,7 +1300,7 @@ struct be_cmd_get_port_name {
|
|||||||
|
|
||||||
/* Returns the number of items in the field array. */
|
/* Returns the number of items in the field array. */
|
||||||
#define BE_NUMBER_OF_FIELD(_type_, _field_) \
|
#define BE_NUMBER_OF_FIELD(_type_, _field_) \
|
||||||
(FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
|
(sizeof_field(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Different types of iSCSI completions to host driver for both initiator
|
* Different types of iSCSI completions to host driver for both initiator
|
||||||
|
@ -2746,7 +2746,7 @@ static int __init libcxgbi_init_module(void)
|
|||||||
{
|
{
|
||||||
pr_info("%s", version);
|
pr_info("%s", version);
|
||||||
|
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, cb) <
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, cb) <
|
||||||
sizeof(struct cxgbi_skb_cb));
|
sizeof(struct cxgbi_skb_cb));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -8689,11 +8689,11 @@ static void __attribute__((unused)) verify_structures(void)
|
|||||||
BUILD_BUG_ON(offsetof(struct pqi_general_admin_request,
|
BUILD_BUG_ON(offsetof(struct pqi_general_admin_request,
|
||||||
data.delete_operational_queue.queue_id) != 12);
|
data.delete_operational_queue.queue_id) != 12);
|
||||||
BUILD_BUG_ON(sizeof(struct pqi_general_admin_request) != 64);
|
BUILD_BUG_ON(sizeof(struct pqi_general_admin_request) != 64);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct pqi_general_admin_request,
|
BUILD_BUG_ON(sizeof_field(struct pqi_general_admin_request,
|
||||||
data.create_operational_iq) != 64 - 11);
|
data.create_operational_iq) != 64 - 11);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct pqi_general_admin_request,
|
BUILD_BUG_ON(sizeof_field(struct pqi_general_admin_request,
|
||||||
data.create_operational_oq) != 64 - 11);
|
data.create_operational_oq) != 64 - 11);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct pqi_general_admin_request,
|
BUILD_BUG_ON(sizeof_field(struct pqi_general_admin_request,
|
||||||
data.delete_operational_queue) != 64 - 11);
|
data.delete_operational_queue) != 64 - 11);
|
||||||
|
|
||||||
BUILD_BUG_ON(offsetof(struct pqi_general_admin_response,
|
BUILD_BUG_ON(offsetof(struct pqi_general_admin_response,
|
||||||
|
@ -41,7 +41,7 @@ struct ql_stats {
|
|||||||
int stat_offset;
|
int stat_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QL_SIZEOF(m) FIELD_SIZEOF(struct ql_adapter, m)
|
#define QL_SIZEOF(m) sizeof_field(struct ql_adapter, m)
|
||||||
#define QL_OFF(m) offsetof(struct ql_adapter, m)
|
#define QL_OFF(m) offsetof(struct ql_adapter, m)
|
||||||
|
|
||||||
static const struct ql_stats ql_gstrings_stats[] = {
|
static const struct ql_stats ql_gstrings_stats[] = {
|
||||||
|
@ -679,7 +679,7 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
|
|||||||
struct ieee80211_sta *sta = control ? control->sta : NULL;
|
struct ieee80211_sta *sta = control ? control->sta : NULL;
|
||||||
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||||
size_t driver_data_room = FIELD_SIZEOF(struct ieee80211_tx_info,
|
size_t driver_data_room = sizeof_field(struct ieee80211_tx_info,
|
||||||
rate_driver_data);
|
rate_driver_data);
|
||||||
|
|
||||||
compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room,
|
compiletime_assert(sizeof(struct wfx_tx_priv) <= driver_data_room,
|
||||||
|
@ -708,7 +708,7 @@ static int __init cxgbit_init(void)
|
|||||||
pr_info("%s dcb enabled.\n", DRV_NAME);
|
pr_info("%s dcb enabled.\n", DRV_NAME);
|
||||||
register_dcbevent_notifier(&cxgbit_dcbevent_nb);
|
register_dcbevent_notifier(&cxgbit_dcbevent_nb);
|
||||||
#endif
|
#endif
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, cb) <
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, cb) <
|
||||||
sizeof(union cxgbit_skb_cb));
|
sizeof(union cxgbit_skb_cb));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1275,7 +1275,7 @@ EXPORT_SYMBOL_GPL(usbatm_usb_disconnect);
|
|||||||
|
|
||||||
static int __init usbatm_usb_init(void)
|
static int __init usbatm_usb_init(void)
|
||||||
{
|
{
|
||||||
if (sizeof(struct usbatm_control) > FIELD_SIZEOF(struct sk_buff, cb)) {
|
if (sizeof(struct usbatm_control) > sizeof_field(struct sk_buff, cb)) {
|
||||||
printk(KERN_ERR "%s unusable with this kernel!\n", usbatm_driver_name);
|
printk(KERN_ERR "%s unusable with this kernel!\n", usbatm_driver_name);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -3509,7 +3509,7 @@ static void ffs_free_inst(struct usb_function_instance *f)
|
|||||||
|
|
||||||
static int ffs_set_inst_name(struct usb_function_instance *fi, const char *name)
|
static int ffs_set_inst_name(struct usb_function_instance *fi, const char *name)
|
||||||
{
|
{
|
||||||
if (strlen(name) >= FIELD_SIZEOF(struct ffs_dev, name))
|
if (strlen(name) >= sizeof_field(struct ffs_dev, name))
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
return ffs_name_dev(to_f_fs_opts(fi)->dev, name);
|
return ffs_name_dev(to_f_fs_opts(fi)->dev, name);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ static struct key *search_fscrypt_keyring(struct key *keyring,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE \
|
#define FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE \
|
||||||
(CONST_STRLEN("fscrypt-") + FIELD_SIZEOF(struct super_block, s_id))
|
(CONST_STRLEN("fscrypt-") + sizeof_field(struct super_block, s_id))
|
||||||
|
|
||||||
#define FSCRYPT_MK_DESCRIPTION_SIZE (2 * FSCRYPT_KEY_IDENTIFIER_SIZE + 1)
|
#define FSCRYPT_MK_DESCRIPTION_SIZE (2 * FSCRYPT_KEY_IDENTIFIER_SIZE + 1)
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ int fsverity_ioctl_enable(struct file *filp, const void __user *uarg)
|
|||||||
if (arg.block_size != PAGE_SIZE)
|
if (arg.block_size != PAGE_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (arg.salt_size > FIELD_SIZEOF(struct fsverity_descriptor, salt))
|
if (arg.salt_size > sizeof_field(struct fsverity_descriptor, salt))
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
|
|
||||||
if (arg.sig_size > FS_VERITY_MAX_SIGNATURE_SIZE)
|
if (arg.sig_size > FS_VERITY_MAX_SIGNATURE_SIZE)
|
||||||
|
@ -420,7 +420,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn)
|
|||||||
|
|
||||||
#define BPF_FIELD_SIZEOF(type, field) \
|
#define BPF_FIELD_SIZEOF(type, field) \
|
||||||
({ \
|
({ \
|
||||||
const int __size = bytes_to_bpf_size(FIELD_SIZEOF(type, field)); \
|
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); \
|
||||||
BUILD_BUG_ON(__size < 0); \
|
BUILD_BUG_ON(__size < 0); \
|
||||||
__size; \
|
__size; \
|
||||||
})
|
})
|
||||||
@ -497,7 +497,7 @@ static inline bool insn_is_zext(const struct bpf_insn *insn)
|
|||||||
|
|
||||||
#define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \
|
#define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \
|
||||||
({ \
|
({ \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(TYPE, MEMBER) != (SIZE)); \
|
BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); \
|
||||||
*(PTR_SIZE) = (SIZE); \
|
*(PTR_SIZE) = (SIZE); \
|
||||||
offsetof(TYPE, MEMBER); \
|
offsetof(TYPE, MEMBER); \
|
||||||
})
|
})
|
||||||
@ -608,7 +608,7 @@ static inline void bpf_compute_data_pointers(struct sk_buff *skb)
|
|||||||
{
|
{
|
||||||
struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb;
|
struct bpf_skb_data_end *cb = (struct bpf_skb_data_end *)skb->cb;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(*cb) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb));
|
||||||
cb->data_meta = skb->data - skb_metadata_len(skb);
|
cb->data_meta = skb->data - skb_metadata_len(skb);
|
||||||
cb->data_end = skb->data + skb_headlen(skb);
|
cb->data_end = skb->data + skb_headlen(skb);
|
||||||
}
|
}
|
||||||
@ -646,9 +646,9 @@ static inline u8 *bpf_skb_cb(struct sk_buff *skb)
|
|||||||
* attached to sockets, we need to clear the bpf_skb_cb() area
|
* attached to sockets, we need to clear the bpf_skb_cb() area
|
||||||
* to not leak previous contents to user space.
|
* to not leak previous contents to user space.
|
||||||
*/
|
*/
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) != BPF_SKB_CB_LEN);
|
BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) != BPF_SKB_CB_LEN);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct __sk_buff, cb) !=
|
BUILD_BUG_ON(sizeof_field(struct __sk_buff, cb) !=
|
||||||
FIELD_SIZEOF(struct qdisc_skb_cb, data));
|
sizeof_field(struct qdisc_skb_cb, data));
|
||||||
|
|
||||||
return qdisc_skb_cb(skb)->data;
|
return qdisc_skb_cb(skb)->data;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ static inline bool is_error_page(struct page *page)
|
|||||||
#define KVM_REQUEST_ARCH_BASE 8
|
#define KVM_REQUEST_ARCH_BASE 8
|
||||||
|
|
||||||
#define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \
|
#define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \
|
||||||
BUILD_BUG_ON((unsigned)(nr) >= (FIELD_SIZEOF(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \
|
BUILD_BUG_ON((unsigned)(nr) >= (sizeof_field(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \
|
||||||
(unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \
|
(unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \
|
||||||
})
|
})
|
||||||
#define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0)
|
#define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0)
|
||||||
|
@ -14,7 +14,7 @@ struct phy_device;
|
|||||||
#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11
|
#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11
|
||||||
|
|
||||||
#define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \
|
#define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \
|
||||||
FIELD_SIZEOF(struct mdio_device, addr)+\
|
sizeof_field(struct mdio_device, addr)+\
|
||||||
PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE)
|
PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE)
|
||||||
|
|
||||||
struct phy_led_trigger {
|
struct phy_led_trigger {
|
||||||
|
@ -37,7 +37,7 @@ struct garp_skb_cb {
|
|||||||
static inline struct garp_skb_cb *garp_cb(struct sk_buff *skb)
|
static inline struct garp_skb_cb *garp_cb(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
BUILD_BUG_ON(sizeof(struct garp_skb_cb) >
|
BUILD_BUG_ON(sizeof(struct garp_skb_cb) >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb));
|
sizeof_field(struct sk_buff, cb));
|
||||||
return (struct garp_skb_cb *)skb->cb;
|
return (struct garp_skb_cb *)skb->cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
/* Used to memset ipv4 address padding. */
|
/* Used to memset ipv4 address padding. */
|
||||||
#define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst)
|
#define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst)
|
||||||
#define IP_TUNNEL_KEY_IPV4_PAD_LEN \
|
#define IP_TUNNEL_KEY_IPV4_PAD_LEN \
|
||||||
(FIELD_SIZEOF(struct ip_tunnel_key, u) - \
|
(sizeof_field(struct ip_tunnel_key, u) - \
|
||||||
FIELD_SIZEOF(struct ip_tunnel_key, u.ipv4))
|
sizeof_field(struct ip_tunnel_key, u.ipv4))
|
||||||
|
|
||||||
struct ip_tunnel_key {
|
struct ip_tunnel_key {
|
||||||
__be64 tun_id;
|
__be64 tun_id;
|
||||||
@ -63,7 +63,7 @@ struct ip_tunnel_key {
|
|||||||
|
|
||||||
/* Maximum tunnel options length. */
|
/* Maximum tunnel options length. */
|
||||||
#define IP_TUNNEL_OPTS_MAX \
|
#define IP_TUNNEL_OPTS_MAX \
|
||||||
GENMASK((FIELD_SIZEOF(struct ip_tunnel_info, \
|
GENMASK((sizeof_field(struct ip_tunnel_info, \
|
||||||
options_len) * BITS_PER_BYTE) - 1, 0)
|
options_len) * BITS_PER_BYTE) - 1, 0)
|
||||||
|
|
||||||
struct ip_tunnel_info {
|
struct ip_tunnel_info {
|
||||||
|
@ -39,7 +39,7 @@ struct mrp_skb_cb {
|
|||||||
static inline struct mrp_skb_cb *mrp_cb(struct sk_buff *skb)
|
static inline struct mrp_skb_cb *mrp_cb(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
BUILD_BUG_ON(sizeof(struct mrp_skb_cb) >
|
BUILD_BUG_ON(sizeof(struct mrp_skb_cb) >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb));
|
sizeof_field(struct sk_buff, cb));
|
||||||
return (struct mrp_skb_cb *)skb->cb;
|
return (struct mrp_skb_cb *)skb->cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ struct nf_conn_help {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define NF_CT_HELPER_BUILD_BUG_ON(structsize) \
|
#define NF_CT_HELPER_BUILD_BUG_ON(structsize) \
|
||||||
BUILD_BUG_ON((structsize) > FIELD_SIZEOF(struct nf_conn_help, data))
|
BUILD_BUG_ON((structsize) > sizeof_field(struct nf_conn_help, data))
|
||||||
|
|
||||||
struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
|
struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
|
||||||
u16 l3num, u8 protonum);
|
u16 l3num, u8 protonum);
|
||||||
|
@ -41,7 +41,7 @@ struct nft_immediate_expr {
|
|||||||
*/
|
*/
|
||||||
static inline u32 nft_cmp_fast_mask(unsigned int len)
|
static inline u32 nft_cmp_fast_mask(unsigned int len)
|
||||||
{
|
{
|
||||||
return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr,
|
return cpu_to_le32(~0U >> (sizeof_field(struct nft_cmp_fast_expr,
|
||||||
data) * BITS_PER_BYTE - len));
|
data) * BITS_PER_BYTE - len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2305,7 +2305,7 @@ struct sock_skb_cb {
|
|||||||
* using skb->cb[] would keep using it directly and utilize its
|
* using skb->cb[] would keep using it directly and utilize its
|
||||||
* alignement guarantee.
|
* alignement guarantee.
|
||||||
*/
|
*/
|
||||||
#define SOCK_SKB_CB_OFFSET ((FIELD_SIZEOF(struct sk_buff, cb) - \
|
#define SOCK_SKB_CB_OFFSET ((sizeof_field(struct sk_buff, cb) - \
|
||||||
sizeof(struct sock_skb_cb)))
|
sizeof(struct sock_skb_cb)))
|
||||||
|
|
||||||
#define SOCK_SKB_CB(__skb) ((struct sock_skb_cb *)((__skb)->cb + \
|
#define SOCK_SKB_CB(__skb) ((struct sock_skb_cb *)((__skb)->cb + \
|
||||||
|
@ -100,7 +100,7 @@ device_initcall(ipc_init);
|
|||||||
static const struct rhashtable_params ipc_kht_params = {
|
static const struct rhashtable_params ipc_kht_params = {
|
||||||
.head_offset = offsetof(struct kern_ipc_perm, khtnode),
|
.head_offset = offsetof(struct kern_ipc_perm, khtnode),
|
||||||
.key_offset = offsetof(struct kern_ipc_perm, key),
|
.key_offset = offsetof(struct kern_ipc_perm, key),
|
||||||
.key_len = FIELD_SIZEOF(struct kern_ipc_perm, key),
|
.key_len = sizeof_field(struct kern_ipc_perm, key),
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1341,7 +1341,7 @@ static u32 sysctl_convert_ctx_access(enum bpf_access_type type,
|
|||||||
*insn++ = BPF_LDX_MEM(
|
*insn++ = BPF_LDX_MEM(
|
||||||
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct bpf_sysctl_kern, write,
|
bpf_target_off(struct bpf_sysctl_kern, write,
|
||||||
FIELD_SIZEOF(struct bpf_sysctl_kern,
|
sizeof_field(struct bpf_sysctl_kern,
|
||||||
write),
|
write),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
|
@ -357,7 +357,7 @@ static int cgroup_storage_check_btf(const struct bpf_map *map,
|
|||||||
* The first field must be a 64 bit integer at 0 offset.
|
* The first field must be a 64 bit integer at 0 offset.
|
||||||
*/
|
*/
|
||||||
m = (struct btf_member *)(key_type + 1);
|
m = (struct btf_member *)(key_type + 1);
|
||||||
size = FIELD_SIZEOF(struct bpf_cgroup_storage_key, cgroup_inode_id);
|
size = sizeof_field(struct bpf_cgroup_storage_key, cgroup_inode_id);
|
||||||
if (!btf_member_is_reg_int(btf, key_type, m, 0, size))
|
if (!btf_member_is_reg_int(btf, key_type, m, 0, size))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ static int cgroup_storage_check_btf(const struct bpf_map *map,
|
|||||||
*/
|
*/
|
||||||
m++;
|
m++;
|
||||||
offset = offsetof(struct bpf_cgroup_storage_key, attach_type);
|
offset = offsetof(struct bpf_cgroup_storage_key, attach_type);
|
||||||
size = FIELD_SIZEOF(struct bpf_cgroup_storage_key, attach_type);
|
size = sizeof_field(struct bpf_cgroup_storage_key, attach_type);
|
||||||
if (!btf_member_is_reg_int(btf, key_type, m, offset, size))
|
if (!btf_member_is_reg_int(btf, key_type, m, offset, size))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ int mrp_request_join(const struct net_device *dev,
|
|||||||
struct mrp_attr *attr;
|
struct mrp_attr *attr;
|
||||||
|
|
||||||
if (sizeof(struct mrp_skb_cb) + len >
|
if (sizeof(struct mrp_skb_cb) + len >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb))
|
sizeof_field(struct sk_buff, cb))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
spin_lock_bh(&app->lock);
|
spin_lock_bh(&app->lock);
|
||||||
@ -548,7 +548,7 @@ void mrp_request_leave(const struct net_device *dev,
|
|||||||
struct mrp_attr *attr;
|
struct mrp_attr *attr;
|
||||||
|
|
||||||
if (sizeof(struct mrp_skb_cb) + len >
|
if (sizeof(struct mrp_skb_cb) + len >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb))
|
sizeof_field(struct sk_buff, cb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_bh(&app->lock);
|
spin_lock_bh(&app->lock);
|
||||||
@ -692,7 +692,7 @@ static int mrp_pdu_parse_vecattr(struct mrp_applicant *app,
|
|||||||
* advance to the next event in its Vector.
|
* advance to the next event in its Vector.
|
||||||
*/
|
*/
|
||||||
if (sizeof(struct mrp_skb_cb) + mrp_cb(skb)->mh->attrlen >
|
if (sizeof(struct mrp_skb_cb) + mrp_cb(skb)->mh->attrlen >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb))
|
sizeof_field(struct sk_buff, cb))
|
||||||
return -1;
|
return -1;
|
||||||
if (skb_copy_bits(skb, *offset, mrp_cb(skb)->attrvalue,
|
if (skb_copy_bits(skb, *offset, mrp_cb(skb)->attrvalue,
|
||||||
mrp_cb(skb)->mh->attrlen) < 0)
|
mrp_cb(skb)->mh->attrlen) < 0)
|
||||||
|
@ -548,7 +548,7 @@ static void batadv_recv_handler_init(void)
|
|||||||
BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_change) != 12);
|
BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_change) != 12);
|
||||||
BUILD_BUG_ON(sizeof(struct batadv_tvlv_roam_adv) != 8);
|
BUILD_BUG_ON(sizeof(struct batadv_tvlv_roam_adv) != 8);
|
||||||
|
|
||||||
i = FIELD_SIZEOF(struct sk_buff, cb);
|
i = sizeof_field(struct sk_buff, cb);
|
||||||
BUILD_BUG_ON(sizeof(struct batadv_skb_cb) > i);
|
BUILD_BUG_ON(sizeof(struct batadv_skb_cb) > i);
|
||||||
|
|
||||||
/* broadcast packet */
|
/* broadcast packet */
|
||||||
|
@ -253,21 +253,21 @@ static int convert___skb_to_skb(struct sk_buff *skb, struct __sk_buff *__skb)
|
|||||||
/* priority is allowed */
|
/* priority is allowed */
|
||||||
|
|
||||||
if (!range_is_zero(__skb, offsetof(struct __sk_buff, priority) +
|
if (!range_is_zero(__skb, offsetof(struct __sk_buff, priority) +
|
||||||
FIELD_SIZEOF(struct __sk_buff, priority),
|
sizeof_field(struct __sk_buff, priority),
|
||||||
offsetof(struct __sk_buff, cb)))
|
offsetof(struct __sk_buff, cb)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* cb is allowed */
|
/* cb is allowed */
|
||||||
|
|
||||||
if (!range_is_zero(__skb, offsetof(struct __sk_buff, cb) +
|
if (!range_is_zero(__skb, offsetof(struct __sk_buff, cb) +
|
||||||
FIELD_SIZEOF(struct __sk_buff, cb),
|
sizeof_field(struct __sk_buff, cb),
|
||||||
offsetof(struct __sk_buff, tstamp)))
|
offsetof(struct __sk_buff, tstamp)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* tstamp is allowed */
|
/* tstamp is allowed */
|
||||||
|
|
||||||
if (!range_is_zero(__skb, offsetof(struct __sk_buff, tstamp) +
|
if (!range_is_zero(__skb, offsetof(struct __sk_buff, tstamp) +
|
||||||
FIELD_SIZEOF(struct __sk_buff, tstamp),
|
sizeof_field(struct __sk_buff, tstamp),
|
||||||
sizeof(struct __sk_buff)))
|
sizeof(struct __sk_buff)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ static int verify_user_bpf_flow_keys(struct bpf_flow_keys *ctx)
|
|||||||
/* flags is allowed */
|
/* flags is allowed */
|
||||||
|
|
||||||
if (!range_is_zero(ctx, offsetof(struct bpf_flow_keys, flags) +
|
if (!range_is_zero(ctx, offsetof(struct bpf_flow_keys, flags) +
|
||||||
FIELD_SIZEOF(struct bpf_flow_keys, flags),
|
sizeof_field(struct bpf_flow_keys, flags),
|
||||||
sizeof(struct bpf_flow_keys)))
|
sizeof(struct bpf_flow_keys)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ static int __init br_init(void)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
err = stp_proto_register(&br_stp_proto);
|
err = stp_proto_register(&br_stp_proto);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -10165,7 +10165,7 @@ static struct hlist_head * __net_init netdev_create_hash(void)
|
|||||||
static int __net_init netdev_init(struct net *net)
|
static int __net_init netdev_init(struct net *net)
|
||||||
{
|
{
|
||||||
BUILD_BUG_ON(GRO_HASH_BUCKETS >
|
BUILD_BUG_ON(GRO_HASH_BUCKETS >
|
||||||
8 * FIELD_SIZEOF(struct napi_struct, gro_bitmask));
|
8 * sizeof_field(struct napi_struct, gro_bitmask));
|
||||||
|
|
||||||
if (net != &init_net)
|
if (net != &init_net)
|
||||||
INIT_LIST_HEAD(&net->dev_base_head);
|
INIT_LIST_HEAD(&net->dev_base_head);
|
||||||
|
@ -274,7 +274,7 @@ static u32 convert_skb_access(int skb_field, int dst_reg, int src_reg,
|
|||||||
|
|
||||||
switch (skb_field) {
|
switch (skb_field) {
|
||||||
case SKF_AD_MARK:
|
case SKF_AD_MARK:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, mark) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_W, dst_reg, src_reg,
|
*insn++ = BPF_LDX_MEM(BPF_W, dst_reg, src_reg,
|
||||||
offsetof(struct sk_buff, mark));
|
offsetof(struct sk_buff, mark));
|
||||||
@ -289,14 +289,14 @@ static u32 convert_skb_access(int skb_field, int dst_reg, int src_reg,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SKF_AD_QUEUE:
|
case SKF_AD_QUEUE:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, queue_mapping) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, queue_mapping) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_H, dst_reg, src_reg,
|
*insn++ = BPF_LDX_MEM(BPF_H, dst_reg, src_reg,
|
||||||
offsetof(struct sk_buff, queue_mapping));
|
offsetof(struct sk_buff, queue_mapping));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKF_AD_VLAN_TAG:
|
case SKF_AD_VLAN_TAG:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_tci) != 2);
|
||||||
|
|
||||||
/* dst_reg = *(u16 *) (src_reg + offsetof(vlan_tci)) */
|
/* dst_reg = *(u16 *) (src_reg + offsetof(vlan_tci)) */
|
||||||
*insn++ = BPF_LDX_MEM(BPF_H, dst_reg, src_reg,
|
*insn++ = BPF_LDX_MEM(BPF_H, dst_reg, src_reg,
|
||||||
@ -322,7 +322,7 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
|
|||||||
|
|
||||||
switch (fp->k) {
|
switch (fp->k) {
|
||||||
case SKF_AD_OFF + SKF_AD_PROTOCOL:
|
case SKF_AD_OFF + SKF_AD_PROTOCOL:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, protocol) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, protocol) != 2);
|
||||||
|
|
||||||
/* A = *(u16 *) (CTX + offsetof(protocol)) */
|
/* A = *(u16 *) (CTX + offsetof(protocol)) */
|
||||||
*insn++ = BPF_LDX_MEM(BPF_H, BPF_REG_A, BPF_REG_CTX,
|
*insn++ = BPF_LDX_MEM(BPF_H, BPF_REG_A, BPF_REG_CTX,
|
||||||
@ -338,8 +338,8 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
|
|||||||
|
|
||||||
case SKF_AD_OFF + SKF_AD_IFINDEX:
|
case SKF_AD_OFF + SKF_AD_IFINDEX:
|
||||||
case SKF_AD_OFF + SKF_AD_HATYPE:
|
case SKF_AD_OFF + SKF_AD_HATYPE:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device, ifindex) != 4);
|
BUILD_BUG_ON(sizeof_field(struct net_device, ifindex) != 4);
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device, type) != 2);
|
BUILD_BUG_ON(sizeof_field(struct net_device, type) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, dev),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, dev),
|
||||||
BPF_REG_TMP, BPF_REG_CTX,
|
BPF_REG_TMP, BPF_REG_CTX,
|
||||||
@ -361,7 +361,7 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SKF_AD_OFF + SKF_AD_RXHASH:
|
case SKF_AD_OFF + SKF_AD_RXHASH:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, hash) != 4);
|
||||||
|
|
||||||
*insn = BPF_LDX_MEM(BPF_W, BPF_REG_A, BPF_REG_CTX,
|
*insn = BPF_LDX_MEM(BPF_W, BPF_REG_A, BPF_REG_CTX,
|
||||||
offsetof(struct sk_buff, hash));
|
offsetof(struct sk_buff, hash));
|
||||||
@ -385,7 +385,7 @@ static bool convert_bpf_extensions(struct sock_filter *fp,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SKF_AD_OFF + SKF_AD_VLAN_TPID:
|
case SKF_AD_OFF + SKF_AD_VLAN_TPID:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_proto) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_proto) != 2);
|
||||||
|
|
||||||
/* A = *(u16 *) (CTX + offsetof(vlan_proto)) */
|
/* A = *(u16 *) (CTX + offsetof(vlan_proto)) */
|
||||||
*insn++ = BPF_LDX_MEM(BPF_H, BPF_REG_A, BPF_REG_CTX,
|
*insn++ = BPF_LDX_MEM(BPF_H, BPF_REG_A, BPF_REG_CTX,
|
||||||
@ -5589,8 +5589,8 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
#define BPF_TCP_SOCK_GET_COMMON(FIELD) \
|
#define BPF_TCP_SOCK_GET_COMMON(FIELD) \
|
||||||
do { \
|
do { \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct tcp_sock, FIELD) > \
|
BUILD_BUG_ON(sizeof_field(struct tcp_sock, FIELD) > \
|
||||||
FIELD_SIZEOF(struct bpf_tcp_sock, FIELD)); \
|
sizeof_field(struct bpf_tcp_sock, FIELD)); \
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct tcp_sock, FIELD),\
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct tcp_sock, FIELD),\
|
||||||
si->dst_reg, si->src_reg, \
|
si->dst_reg, si->src_reg, \
|
||||||
offsetof(struct tcp_sock, FIELD)); \
|
offsetof(struct tcp_sock, FIELD)); \
|
||||||
@ -5598,9 +5598,9 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
#define BPF_INET_SOCK_GET_COMMON(FIELD) \
|
#define BPF_INET_SOCK_GET_COMMON(FIELD) \
|
||||||
do { \
|
do { \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct inet_connection_sock, \
|
BUILD_BUG_ON(sizeof_field(struct inet_connection_sock, \
|
||||||
FIELD) > \
|
FIELD) > \
|
||||||
FIELD_SIZEOF(struct bpf_tcp_sock, FIELD)); \
|
sizeof_field(struct bpf_tcp_sock, FIELD)); \
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
|
||||||
struct inet_connection_sock, \
|
struct inet_connection_sock, \
|
||||||
FIELD), \
|
FIELD), \
|
||||||
@ -5615,7 +5615,7 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
switch (si->off) {
|
switch (si->off) {
|
||||||
case offsetof(struct bpf_tcp_sock, rtt_min):
|
case offsetof(struct bpf_tcp_sock, rtt_min):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct tcp_sock, rtt_min) !=
|
BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) !=
|
||||||
sizeof(struct minmax));
|
sizeof(struct minmax));
|
||||||
BUILD_BUG_ON(sizeof(struct minmax) <
|
BUILD_BUG_ON(sizeof(struct minmax) <
|
||||||
sizeof(struct minmax_sample));
|
sizeof(struct minmax_sample));
|
||||||
@ -5780,8 +5780,8 @@ u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
#define BPF_XDP_SOCK_GET(FIELD) \
|
#define BPF_XDP_SOCK_GET(FIELD) \
|
||||||
do { \
|
do { \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct xdp_sock, FIELD) > \
|
BUILD_BUG_ON(sizeof_field(struct xdp_sock, FIELD) > \
|
||||||
FIELD_SIZEOF(struct bpf_xdp_sock, FIELD)); \
|
sizeof_field(struct bpf_xdp_sock, FIELD)); \
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct xdp_sock, FIELD),\
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct xdp_sock, FIELD),\
|
||||||
si->dst_reg, si->src_reg, \
|
si->dst_reg, si->src_reg, \
|
||||||
offsetof(struct xdp_sock, FIELD)); \
|
offsetof(struct xdp_sock, FIELD)); \
|
||||||
@ -7344,7 +7344,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
case offsetof(struct __sk_buff, cb[0]) ...
|
case offsetof(struct __sk_buff, cb[0]) ...
|
||||||
offsetofend(struct __sk_buff, cb[4]) - 1:
|
offsetofend(struct __sk_buff, cb[4]) - 1:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct qdisc_skb_cb, data) < 20);
|
BUILD_BUG_ON(sizeof_field(struct qdisc_skb_cb, data) < 20);
|
||||||
BUILD_BUG_ON((offsetof(struct sk_buff, cb) +
|
BUILD_BUG_ON((offsetof(struct sk_buff, cb) +
|
||||||
offsetof(struct qdisc_skb_cb, data)) %
|
offsetof(struct qdisc_skb_cb, data)) %
|
||||||
sizeof(__u64));
|
sizeof(__u64));
|
||||||
@ -7363,7 +7363,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct __sk_buff, tc_classid):
|
case offsetof(struct __sk_buff, tc_classid):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct qdisc_skb_cb, tc_classid) != 2);
|
BUILD_BUG_ON(sizeof_field(struct qdisc_skb_cb, tc_classid) != 2);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
off -= offsetof(struct __sk_buff, tc_classid);
|
off -= offsetof(struct __sk_buff, tc_classid);
|
||||||
@ -7434,7 +7434,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, family):
|
case offsetof(struct __sk_buff, family):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_family) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_family) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
@ -7445,7 +7445,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
2, target_size));
|
2, target_size));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, remote_ip4):
|
case offsetof(struct __sk_buff, remote_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_daddr) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_daddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
@ -7456,7 +7456,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
4, target_size));
|
4, target_size));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, local_ip4):
|
case offsetof(struct __sk_buff, local_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_rcv_saddr) != 4);
|
skc_rcv_saddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
||||||
@ -7470,7 +7470,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct __sk_buff, remote_ip6[0]) ...
|
case offsetof(struct __sk_buff, remote_ip6[0]) ...
|
||||||
offsetof(struct __sk_buff, remote_ip6[3]):
|
offsetof(struct __sk_buff, remote_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_daddr.s6_addr32[0]) != 4);
|
skc_v6_daddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -7490,7 +7490,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct __sk_buff, local_ip6[0]) ...
|
case offsetof(struct __sk_buff, local_ip6[0]) ...
|
||||||
offsetof(struct __sk_buff, local_ip6[3]):
|
offsetof(struct __sk_buff, local_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -7509,7 +7509,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct __sk_buff, remote_port):
|
case offsetof(struct __sk_buff, remote_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_dport) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_dport) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
@ -7524,7 +7524,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct __sk_buff, local_port):
|
case offsetof(struct __sk_buff, local_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_num) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_num) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_buff, sk),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
@ -7535,7 +7535,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct __sk_buff, tstamp):
|
case offsetof(struct __sk_buff, tstamp):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, tstamp) != 8);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, tstamp) != 8);
|
||||||
|
|
||||||
if (type == BPF_WRITE)
|
if (type == BPF_WRITE)
|
||||||
*insn++ = BPF_STX_MEM(BPF_DW,
|
*insn++ = BPF_STX_MEM(BPF_DW,
|
||||||
@ -7573,7 +7573,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct __sk_buff, wire_len):
|
case offsetof(struct __sk_buff, wire_len):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct qdisc_skb_cb, pkt_len) != 4);
|
BUILD_BUG_ON(sizeof_field(struct qdisc_skb_cb, pkt_len) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
off -= offsetof(struct __sk_buff, wire_len);
|
off -= offsetof(struct __sk_buff, wire_len);
|
||||||
@ -7603,7 +7603,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
switch (si->off) {
|
switch (si->off) {
|
||||||
case offsetof(struct bpf_sock, bound_dev_if):
|
case offsetof(struct bpf_sock, bound_dev_if):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock, sk_bound_dev_if) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock, sk_bound_dev_if) != 4);
|
||||||
|
|
||||||
if (type == BPF_WRITE)
|
if (type == BPF_WRITE)
|
||||||
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
||||||
@ -7614,7 +7614,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock, mark):
|
case offsetof(struct bpf_sock, mark):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock, sk_mark) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock, sk_mark) != 4);
|
||||||
|
|
||||||
if (type == BPF_WRITE)
|
if (type == BPF_WRITE)
|
||||||
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
||||||
@ -7625,7 +7625,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock, priority):
|
case offsetof(struct bpf_sock, priority):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock, sk_priority) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock, sk_priority) != 4);
|
||||||
|
|
||||||
if (type == BPF_WRITE)
|
if (type == BPF_WRITE)
|
||||||
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
*insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
|
||||||
@ -7641,7 +7641,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common,
|
bpf_target_off(struct sock_common,
|
||||||
skc_family,
|
skc_family,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_family),
|
skc_family),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7668,7 +7668,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
*insn++ = BPF_LDX_MEM(
|
*insn++ = BPF_LDX_MEM(
|
||||||
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common, skc_rcv_saddr,
|
bpf_target_off(struct sock_common, skc_rcv_saddr,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_rcv_saddr),
|
skc_rcv_saddr),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7677,7 +7677,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
*insn++ = BPF_LDX_MEM(
|
*insn++ = BPF_LDX_MEM(
|
||||||
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common, skc_daddr,
|
bpf_target_off(struct sock_common, skc_daddr,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_daddr),
|
skc_daddr),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7691,7 +7691,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
bpf_target_off(
|
bpf_target_off(
|
||||||
struct sock_common,
|
struct sock_common,
|
||||||
skc_v6_rcv_saddr.s6_addr32[0],
|
skc_v6_rcv_saddr.s6_addr32[0],
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_v6_rcv_saddr.s6_addr32[0]),
|
skc_v6_rcv_saddr.s6_addr32[0]),
|
||||||
target_size) + off);
|
target_size) + off);
|
||||||
#else
|
#else
|
||||||
@ -7708,7 +7708,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
BPF_SIZE(si->code), si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common,
|
bpf_target_off(struct sock_common,
|
||||||
skc_v6_daddr.s6_addr32[0],
|
skc_v6_daddr.s6_addr32[0],
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_v6_daddr.s6_addr32[0]),
|
skc_v6_daddr.s6_addr32[0]),
|
||||||
target_size) + off);
|
target_size) + off);
|
||||||
#else
|
#else
|
||||||
@ -7722,7 +7722,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
BPF_FIELD_SIZEOF(struct sock_common, skc_num),
|
BPF_FIELD_SIZEOF(struct sock_common, skc_num),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common, skc_num,
|
bpf_target_off(struct sock_common, skc_num,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_num),
|
skc_num),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7732,7 +7732,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
BPF_FIELD_SIZEOF(struct sock_common, skc_dport),
|
BPF_FIELD_SIZEOF(struct sock_common, skc_dport),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common, skc_dport,
|
bpf_target_off(struct sock_common, skc_dport,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_dport),
|
skc_dport),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7742,7 +7742,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
|
|||||||
BPF_FIELD_SIZEOF(struct sock_common, skc_state),
|
BPF_FIELD_SIZEOF(struct sock_common, skc_state),
|
||||||
si->dst_reg, si->src_reg,
|
si->dst_reg, si->src_reg,
|
||||||
bpf_target_off(struct sock_common, skc_state,
|
bpf_target_off(struct sock_common, skc_state,
|
||||||
FIELD_SIZEOF(struct sock_common,
|
sizeof_field(struct sock_common,
|
||||||
skc_state),
|
skc_state),
|
||||||
target_size));
|
target_size));
|
||||||
break;
|
break;
|
||||||
@ -7837,7 +7837,7 @@ static u32 xdp_convert_ctx_access(enum bpf_access_type type,
|
|||||||
si->src_reg, offsetof(S, F)); \
|
si->src_reg, offsetof(S, F)); \
|
||||||
*insn++ = BPF_LDX_MEM( \
|
*insn++ = BPF_LDX_MEM( \
|
||||||
SIZE, si->dst_reg, si->dst_reg, \
|
SIZE, si->dst_reg, si->dst_reg, \
|
||||||
bpf_target_off(NS, NF, FIELD_SIZEOF(NS, NF), \
|
bpf_target_off(NS, NF, sizeof_field(NS, NF), \
|
||||||
target_size) \
|
target_size) \
|
||||||
+ OFF); \
|
+ OFF); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -7868,7 +7868,7 @@ static u32 xdp_convert_ctx_access(enum bpf_access_type type,
|
|||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(S, F), tmp_reg, \
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(S, F), tmp_reg, \
|
||||||
si->dst_reg, offsetof(S, F)); \
|
si->dst_reg, offsetof(S, F)); \
|
||||||
*insn++ = BPF_STX_MEM(SIZE, tmp_reg, si->src_reg, \
|
*insn++ = BPF_STX_MEM(SIZE, tmp_reg, si->src_reg, \
|
||||||
bpf_target_off(NS, NF, FIELD_SIZEOF(NS, NF), \
|
bpf_target_off(NS, NF, sizeof_field(NS, NF), \
|
||||||
target_size) \
|
target_size) \
|
||||||
+ OFF); \
|
+ OFF); \
|
||||||
*insn++ = BPF_LDX_MEM(BPF_DW, tmp_reg, si->dst_reg, \
|
*insn++ = BPF_LDX_MEM(BPF_DW, tmp_reg, si->dst_reg, \
|
||||||
@ -7930,8 +7930,8 @@ static u32 sock_addr_convert_ctx_access(enum bpf_access_type type,
|
|||||||
*/
|
*/
|
||||||
BUILD_BUG_ON(offsetof(struct sockaddr_in, sin_port) !=
|
BUILD_BUG_ON(offsetof(struct sockaddr_in, sin_port) !=
|
||||||
offsetof(struct sockaddr_in6, sin6_port));
|
offsetof(struct sockaddr_in6, sin6_port));
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sockaddr_in, sin_port) !=
|
BUILD_BUG_ON(sizeof_field(struct sockaddr_in, sin_port) !=
|
||||||
FIELD_SIZEOF(struct sockaddr_in6, sin6_port));
|
sizeof_field(struct sockaddr_in6, sin6_port));
|
||||||
SOCK_ADDR_LOAD_OR_STORE_NESTED_FIELD(struct bpf_sock_addr_kern,
|
SOCK_ADDR_LOAD_OR_STORE_NESTED_FIELD(struct bpf_sock_addr_kern,
|
||||||
struct sockaddr_in6, uaddr,
|
struct sockaddr_in6, uaddr,
|
||||||
sin6_port, tmp_reg);
|
sin6_port, tmp_reg);
|
||||||
@ -7997,8 +7997,8 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
/* Helper macro for adding read access to tcp_sock or sock fields. */
|
/* Helper macro for adding read access to tcp_sock or sock fields. */
|
||||||
#define SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ) \
|
#define SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ) \
|
||||||
do { \
|
do { \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(OBJ, OBJ_FIELD) > \
|
BUILD_BUG_ON(sizeof_field(OBJ, OBJ_FIELD) > \
|
||||||
FIELD_SIZEOF(struct bpf_sock_ops, BPF_FIELD)); \
|
sizeof_field(struct bpf_sock_ops, BPF_FIELD)); \
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
|
||||||
struct bpf_sock_ops_kern, \
|
struct bpf_sock_ops_kern, \
|
||||||
is_fullsock), \
|
is_fullsock), \
|
||||||
@ -8031,8 +8031,8 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
#define SOCK_OPS_SET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ) \
|
#define SOCK_OPS_SET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ) \
|
||||||
do { \
|
do { \
|
||||||
int reg = BPF_REG_9; \
|
int reg = BPF_REG_9; \
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(OBJ, OBJ_FIELD) > \
|
BUILD_BUG_ON(sizeof_field(OBJ, OBJ_FIELD) > \
|
||||||
FIELD_SIZEOF(struct bpf_sock_ops, BPF_FIELD)); \
|
sizeof_field(struct bpf_sock_ops, BPF_FIELD)); \
|
||||||
if (si->dst_reg == reg || si->src_reg == reg) \
|
if (si->dst_reg == reg || si->src_reg == reg) \
|
||||||
reg--; \
|
reg--; \
|
||||||
if (si->dst_reg == reg || si->src_reg == reg) \
|
if (si->dst_reg == reg || si->src_reg == reg) \
|
||||||
@ -8073,12 +8073,12 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
switch (si->off) {
|
switch (si->off) {
|
||||||
case offsetof(struct bpf_sock_ops, op) ...
|
case offsetof(struct bpf_sock_ops, op) ...
|
||||||
offsetof(struct bpf_sock_ops, replylong[3]):
|
offsetof(struct bpf_sock_ops, replylong[3]):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct bpf_sock_ops, op) !=
|
BUILD_BUG_ON(sizeof_field(struct bpf_sock_ops, op) !=
|
||||||
FIELD_SIZEOF(struct bpf_sock_ops_kern, op));
|
sizeof_field(struct bpf_sock_ops_kern, op));
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct bpf_sock_ops, reply) !=
|
BUILD_BUG_ON(sizeof_field(struct bpf_sock_ops, reply) !=
|
||||||
FIELD_SIZEOF(struct bpf_sock_ops_kern, reply));
|
sizeof_field(struct bpf_sock_ops_kern, reply));
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct bpf_sock_ops, replylong) !=
|
BUILD_BUG_ON(sizeof_field(struct bpf_sock_ops, replylong) !=
|
||||||
FIELD_SIZEOF(struct bpf_sock_ops_kern, replylong));
|
sizeof_field(struct bpf_sock_ops_kern, replylong));
|
||||||
off = si->off;
|
off = si->off;
|
||||||
off -= offsetof(struct bpf_sock_ops, op);
|
off -= offsetof(struct bpf_sock_ops, op);
|
||||||
off += offsetof(struct bpf_sock_ops_kern, op);
|
off += offsetof(struct bpf_sock_ops_kern, op);
|
||||||
@ -8091,7 +8091,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, family):
|
case offsetof(struct bpf_sock_ops, family):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_family) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_family) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct bpf_sock_ops_kern, sk),
|
struct bpf_sock_ops_kern, sk),
|
||||||
@ -8102,7 +8102,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, remote_ip4):
|
case offsetof(struct bpf_sock_ops, remote_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_daddr) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_daddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct bpf_sock_ops_kern, sk),
|
struct bpf_sock_ops_kern, sk),
|
||||||
@ -8113,7 +8113,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, local_ip4):
|
case offsetof(struct bpf_sock_ops, local_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_rcv_saddr) != 4);
|
skc_rcv_saddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
@ -8128,7 +8128,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct bpf_sock_ops, remote_ip6[0]) ...
|
case offsetof(struct bpf_sock_ops, remote_ip6[0]) ...
|
||||||
offsetof(struct bpf_sock_ops, remote_ip6[3]):
|
offsetof(struct bpf_sock_ops, remote_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_daddr.s6_addr32[0]) != 4);
|
skc_v6_daddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -8149,7 +8149,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct bpf_sock_ops, local_ip6[0]) ...
|
case offsetof(struct bpf_sock_ops, local_ip6[0]) ...
|
||||||
offsetof(struct bpf_sock_ops, local_ip6[3]):
|
offsetof(struct bpf_sock_ops, local_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -8168,7 +8168,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, remote_port):
|
case offsetof(struct bpf_sock_ops, remote_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_dport) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_dport) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct bpf_sock_ops_kern, sk),
|
struct bpf_sock_ops_kern, sk),
|
||||||
@ -8182,7 +8182,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, local_port):
|
case offsetof(struct bpf_sock_ops, local_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_num) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_num) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct bpf_sock_ops_kern, sk),
|
struct bpf_sock_ops_kern, sk),
|
||||||
@ -8202,7 +8202,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, state):
|
case offsetof(struct bpf_sock_ops, state):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_state) != 1);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_state) != 1);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct bpf_sock_ops_kern, sk),
|
struct bpf_sock_ops_kern, sk),
|
||||||
@ -8213,7 +8213,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, rtt_min):
|
case offsetof(struct bpf_sock_ops, rtt_min):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct tcp_sock, rtt_min) !=
|
BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) !=
|
||||||
sizeof(struct minmax));
|
sizeof(struct minmax));
|
||||||
BUILD_BUG_ON(sizeof(struct minmax) <
|
BUILD_BUG_ON(sizeof(struct minmax) <
|
||||||
sizeof(struct minmax_sample));
|
sizeof(struct minmax_sample));
|
||||||
@ -8224,7 +8224,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
offsetof(struct bpf_sock_ops_kern, sk));
|
offsetof(struct bpf_sock_ops_kern, sk));
|
||||||
*insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->dst_reg,
|
*insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->dst_reg,
|
||||||
offsetof(struct tcp_sock, rtt_min) +
|
offsetof(struct tcp_sock, rtt_min) +
|
||||||
FIELD_SIZEOF(struct minmax_sample, t));
|
sizeof_field(struct minmax_sample, t));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, bpf_sock_ops_cb_flags):
|
case offsetof(struct bpf_sock_ops, bpf_sock_ops_cb_flags):
|
||||||
@ -8366,7 +8366,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
offsetof(struct sk_msg, data_end));
|
offsetof(struct sk_msg, data_end));
|
||||||
break;
|
break;
|
||||||
case offsetof(struct sk_msg_md, family):
|
case offsetof(struct sk_msg_md, family):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_family) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_family) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct sk_msg, sk),
|
struct sk_msg, sk),
|
||||||
@ -8377,7 +8377,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct sk_msg_md, remote_ip4):
|
case offsetof(struct sk_msg_md, remote_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_daddr) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_daddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct sk_msg, sk),
|
struct sk_msg, sk),
|
||||||
@ -8388,7 +8388,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct sk_msg_md, local_ip4):
|
case offsetof(struct sk_msg_md, local_ip4):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_rcv_saddr) != 4);
|
skc_rcv_saddr) != 4);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
@ -8403,7 +8403,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct sk_msg_md, remote_ip6[0]) ...
|
case offsetof(struct sk_msg_md, remote_ip6[0]) ...
|
||||||
offsetof(struct sk_msg_md, remote_ip6[3]):
|
offsetof(struct sk_msg_md, remote_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_daddr.s6_addr32[0]) != 4);
|
skc_v6_daddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -8424,7 +8424,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
case offsetof(struct sk_msg_md, local_ip6[0]) ...
|
case offsetof(struct sk_msg_md, local_ip6[0]) ...
|
||||||
offsetof(struct sk_msg_md, local_ip6[3]):
|
offsetof(struct sk_msg_md, local_ip6[3]):
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common,
|
BUILD_BUG_ON(sizeof_field(struct sock_common,
|
||||||
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
skc_v6_rcv_saddr.s6_addr32[0]) != 4);
|
||||||
|
|
||||||
off = si->off;
|
off = si->off;
|
||||||
@ -8443,7 +8443,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct sk_msg_md, remote_port):
|
case offsetof(struct sk_msg_md, remote_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_dport) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_dport) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct sk_msg, sk),
|
struct sk_msg, sk),
|
||||||
@ -8457,7 +8457,7 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case offsetof(struct sk_msg_md, local_port):
|
case offsetof(struct sk_msg_md, local_port):
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sock_common, skc_num) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sock_common, skc_num) != 2);
|
||||||
|
|
||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
|
||||||
struct sk_msg, sk),
|
struct sk_msg, sk),
|
||||||
@ -8847,7 +8847,7 @@ sk_reuseport_is_valid_access(int off, int size,
|
|||||||
|
|
||||||
/* Fields that allow narrowing */
|
/* Fields that allow narrowing */
|
||||||
case bpf_ctx_range(struct sk_reuseport_md, eth_protocol):
|
case bpf_ctx_range(struct sk_reuseport_md, eth_protocol):
|
||||||
if (size < FIELD_SIZEOF(struct sk_buff, protocol))
|
if (size < sizeof_field(struct sk_buff, protocol))
|
||||||
return false;
|
return false;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case bpf_ctx_range(struct sk_reuseport_md, ip_protocol):
|
case bpf_ctx_range(struct sk_reuseport_md, ip_protocol):
|
||||||
@ -8865,7 +8865,7 @@ sk_reuseport_is_valid_access(int off, int size,
|
|||||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_reuseport_kern, F), \
|
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_reuseport_kern, F), \
|
||||||
si->dst_reg, si->src_reg, \
|
si->dst_reg, si->src_reg, \
|
||||||
bpf_target_off(struct sk_reuseport_kern, F, \
|
bpf_target_off(struct sk_reuseport_kern, F, \
|
||||||
FIELD_SIZEOF(struct sk_reuseport_kern, F), \
|
sizeof_field(struct sk_reuseport_kern, F), \
|
||||||
target_size)); \
|
target_size)); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -599,8 +599,8 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
|
|||||||
offset += sizeof(struct gre_base_hdr);
|
offset += sizeof(struct gre_base_hdr);
|
||||||
|
|
||||||
if (hdr->flags & GRE_CSUM)
|
if (hdr->flags & GRE_CSUM)
|
||||||
offset += FIELD_SIZEOF(struct gre_full_hdr, csum) +
|
offset += sizeof_field(struct gre_full_hdr, csum) +
|
||||||
FIELD_SIZEOF(struct gre_full_hdr, reserved1);
|
sizeof_field(struct gre_full_hdr, reserved1);
|
||||||
|
|
||||||
if (hdr->flags & GRE_KEY) {
|
if (hdr->flags & GRE_KEY) {
|
||||||
const __be32 *keyid;
|
const __be32 *keyid;
|
||||||
@ -622,11 +622,11 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
|
|||||||
else
|
else
|
||||||
key_keyid->keyid = *keyid & GRE_PPTP_KEY_MASK;
|
key_keyid->keyid = *keyid & GRE_PPTP_KEY_MASK;
|
||||||
}
|
}
|
||||||
offset += FIELD_SIZEOF(struct gre_full_hdr, key);
|
offset += sizeof_field(struct gre_full_hdr, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->flags & GRE_SEQ)
|
if (hdr->flags & GRE_SEQ)
|
||||||
offset += FIELD_SIZEOF(struct pptp_gre_header, seq);
|
offset += sizeof_field(struct pptp_gre_header, seq);
|
||||||
|
|
||||||
if (gre_ver == 0) {
|
if (gre_ver == 0) {
|
||||||
if (*p_proto == htons(ETH_P_TEB)) {
|
if (*p_proto == htons(ETH_P_TEB)) {
|
||||||
@ -653,7 +653,7 @@ __skb_flow_dissect_gre(const struct sk_buff *skb,
|
|||||||
u8 *ppp_hdr;
|
u8 *ppp_hdr;
|
||||||
|
|
||||||
if (hdr->flags & GRE_ACK)
|
if (hdr->flags & GRE_ACK)
|
||||||
offset += FIELD_SIZEOF(struct pptp_gre_header, ack);
|
offset += sizeof_field(struct pptp_gre_header, ack);
|
||||||
|
|
||||||
ppp_hdr = __skb_header_pointer(skb, *p_nhoff + offset,
|
ppp_hdr = __skb_header_pointer(skb, *p_nhoff + offset,
|
||||||
sizeof(_ppp_hdr),
|
sizeof(_ppp_hdr),
|
||||||
|
@ -36,7 +36,7 @@ static u32 xdp_mem_id_hashfn(const void *data, u32 len, u32 seed)
|
|||||||
const u32 *k = data;
|
const u32 *k = data;
|
||||||
const u32 key = *k;
|
const u32 key = *k;
|
||||||
|
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct xdp_mem_allocator, mem.id)
|
BUILD_BUG_ON(sizeof_field(struct xdp_mem_allocator, mem.id)
|
||||||
!= sizeof(u32));
|
!= sizeof(u32));
|
||||||
|
|
||||||
/* Use cyclic increasing ID as direct hash key */
|
/* Use cyclic increasing ID as direct hash key */
|
||||||
@ -56,7 +56,7 @@ static const struct rhashtable_params mem_id_rht_params = {
|
|||||||
.nelem_hint = 64,
|
.nelem_hint = 64,
|
||||||
.head_offset = offsetof(struct xdp_mem_allocator, node),
|
.head_offset = offsetof(struct xdp_mem_allocator, node),
|
||||||
.key_offset = offsetof(struct xdp_mem_allocator, mem.id),
|
.key_offset = offsetof(struct xdp_mem_allocator, mem.id),
|
||||||
.key_len = FIELD_SIZEOF(struct xdp_mem_allocator, mem.id),
|
.key_len = sizeof_field(struct xdp_mem_allocator, mem.id),
|
||||||
.max_size = MEM_ID_MAX,
|
.max_size = MEM_ID_MAX,
|
||||||
.min_size = 8,
|
.min_size = 8,
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
|
@ -1132,7 +1132,7 @@ static int __init dccp_init(void)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct dccp_skb_cb) >
|
BUILD_BUG_ON(sizeof(struct dccp_skb_cb) >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb));
|
sizeof_field(struct sk_buff, cb));
|
||||||
rc = percpu_counter_init(&dccp_orphan_count, 0, GFP_KERNEL);
|
rc = percpu_counter_init(&dccp_orphan_count, 0, GFP_KERNEL);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_fail;
|
goto out_fail;
|
||||||
|
@ -1464,8 +1464,8 @@ static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = {
|
|||||||
[IFLA_GRE_OFLAGS] = { .type = NLA_U16 },
|
[IFLA_GRE_OFLAGS] = { .type = NLA_U16 },
|
||||||
[IFLA_GRE_IKEY] = { .type = NLA_U32 },
|
[IFLA_GRE_IKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_GRE_OKEY] = { .type = NLA_U32 },
|
[IFLA_GRE_OKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_GRE_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) },
|
[IFLA_GRE_LOCAL] = { .len = sizeof_field(struct iphdr, saddr) },
|
||||||
[IFLA_GRE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
[IFLA_GRE_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) },
|
||||||
[IFLA_GRE_TTL] = { .type = NLA_U8 },
|
[IFLA_GRE_TTL] = { .type = NLA_U8 },
|
||||||
[IFLA_GRE_TOS] = { .type = NLA_U8 },
|
[IFLA_GRE_TOS] = { .type = NLA_U8 },
|
||||||
[IFLA_GRE_PMTUDISC] = { .type = NLA_U8 },
|
[IFLA_GRE_PMTUDISC] = { .type = NLA_U8 },
|
||||||
|
@ -580,8 +580,8 @@ static const struct nla_policy vti_policy[IFLA_VTI_MAX + 1] = {
|
|||||||
[IFLA_VTI_LINK] = { .type = NLA_U32 },
|
[IFLA_VTI_LINK] = { .type = NLA_U32 },
|
||||||
[IFLA_VTI_IKEY] = { .type = NLA_U32 },
|
[IFLA_VTI_IKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_VTI_OKEY] = { .type = NLA_U32 },
|
[IFLA_VTI_OKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_VTI_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) },
|
[IFLA_VTI_LOCAL] = { .len = sizeof_field(struct iphdr, saddr) },
|
||||||
[IFLA_VTI_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
|
[IFLA_VTI_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) },
|
||||||
[IFLA_VTI_FWMARK] = { .type = NLA_U32 },
|
[IFLA_VTI_FWMARK] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3949,7 +3949,7 @@ void __init tcp_init(void)
|
|||||||
|
|
||||||
BUILD_BUG_ON(TCP_MIN_SND_MSS <= MAX_TCP_OPTION_SPACE);
|
BUILD_BUG_ON(TCP_MIN_SND_MSS <= MAX_TCP_OPTION_SPACE);
|
||||||
BUILD_BUG_ON(sizeof(struct tcp_skb_cb) >
|
BUILD_BUG_ON(sizeof(struct tcp_skb_cb) >
|
||||||
FIELD_SIZEOF(struct sk_buff, cb));
|
sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
percpu_counter_init(&tcp_sockets_allocated, 0, GFP_KERNEL);
|
percpu_counter_init(&tcp_sockets_allocated, 0, GFP_KERNEL);
|
||||||
percpu_counter_init(&tcp_orphan_count, 0, GFP_KERNEL);
|
percpu_counter_init(&tcp_orphan_count, 0, GFP_KERNEL);
|
||||||
|
@ -2170,8 +2170,8 @@ static const struct nla_policy ip6gre_policy[IFLA_GRE_MAX + 1] = {
|
|||||||
[IFLA_GRE_OFLAGS] = { .type = NLA_U16 },
|
[IFLA_GRE_OFLAGS] = { .type = NLA_U16 },
|
||||||
[IFLA_GRE_IKEY] = { .type = NLA_U32 },
|
[IFLA_GRE_IKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_GRE_OKEY] = { .type = NLA_U32 },
|
[IFLA_GRE_OKEY] = { .type = NLA_U32 },
|
||||||
[IFLA_GRE_LOCAL] = { .len = FIELD_SIZEOF(struct ipv6hdr, saddr) },
|
[IFLA_GRE_LOCAL] = { .len = sizeof_field(struct ipv6hdr, saddr) },
|
||||||
[IFLA_GRE_REMOTE] = { .len = FIELD_SIZEOF(struct ipv6hdr, daddr) },
|
[IFLA_GRE_REMOTE] = { .len = sizeof_field(struct ipv6hdr, daddr) },
|
||||||
[IFLA_GRE_TTL] = { .type = NLA_U8 },
|
[IFLA_GRE_TTL] = { .type = NLA_U8 },
|
||||||
[IFLA_GRE_ENCAP_LIMIT] = { .type = NLA_U8 },
|
[IFLA_GRE_ENCAP_LIMIT] = { .type = NLA_U8 },
|
||||||
[IFLA_GRE_FLOWINFO] = { .type = NLA_U32 },
|
[IFLA_GRE_FLOWINFO] = { .type = NLA_U32 },
|
||||||
|
@ -50,7 +50,7 @@ static struct iucv_interface *pr_iucv;
|
|||||||
static const u8 iprm_shutdown[8] =
|
static const u8 iprm_shutdown[8] =
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
|
||||||
|
|
||||||
#define TRGCLS_SIZE FIELD_SIZEOF(struct iucv_message, class)
|
#define TRGCLS_SIZE sizeof_field(struct iucv_message, class)
|
||||||
|
|
||||||
#define __iucv_sock_wait(sk, condition, timeo, ret) \
|
#define __iucv_sock_wait(sk, condition, timeo, ret) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -7595,7 +7595,7 @@ int nft_validate_register_load(enum nft_registers reg, unsigned int len)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (reg * NFT_REG32_SIZE + len > FIELD_SIZEOF(struct nft_regs, data))
|
if (reg * NFT_REG32_SIZE + len > sizeof_field(struct nft_regs, data))
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -7643,7 +7643,7 @@ int nft_validate_register_store(const struct nft_ctx *ctx,
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (reg * NFT_REG32_SIZE + len >
|
if (reg * NFT_REG32_SIZE + len >
|
||||||
FIELD_SIZEOF(struct nft_regs, data))
|
sizeof_field(struct nft_regs, data))
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
if (data != NULL && type != NFT_DATA_VALUE)
|
if (data != NULL && type != NFT_DATA_VALUE)
|
||||||
|
@ -236,7 +236,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[],
|
|||||||
nla_strlcpy(helper->name,
|
nla_strlcpy(helper->name,
|
||||||
tb[NFCTH_NAME], NF_CT_HELPER_NAME_LEN);
|
tb[NFCTH_NAME], NF_CT_HELPER_NAME_LEN);
|
||||||
size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));
|
size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));
|
||||||
if (size > FIELD_SIZEOF(struct nf_conn_help, data)) {
|
if (size > sizeof_field(struct nf_conn_help, data)) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user