BACKPORT: 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 Change-Id: I24296633f28fea05d12618c8e47dc8acb8df18d8 Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> Link: https://lore.kernel.org/r/20190924105839.110713-3-pankaj.laxminarayan.bharadiya@intel.com Co-developed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: David Miller <davem@davemloft.net> # for net
This commit is contained in:
committed by
bengris32
parent
9c88ef1085
commit
fd78a84b36
@@ -939,7 +939,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
|
||||||
|
|||||||
@@ -822,7 +822,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() 宏,如果你需要可以使用它们。你可以
|
||||||
自己看看那个头文件里还定义了什么你可以拿来用的东西,如果有定义的话,你就不应
|
自己看看那个头文件里还定义了什么你可以拿来用的东西,如果有定义的话,你就不应
|
||||||
|
|||||||
@@ -45,10 +45,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)
|
||||||
|
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ static int build_body(struct jit_ctx *ctx)
|
|||||||
emit_load_imm(r_A, k, ctx);
|
emit_load_imm(r_A, k, ctx);
|
||||||
break;
|
break;
|
||||||
case BPF_LD | BPF_W | BPF_LEN:
|
case BPF_LD | BPF_W | BPF_LEN:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, len) != 4);
|
||||||
/* A <- len ==> lw r_A, offset(skb) */
|
/* A <- len ==> lw r_A, offset(skb) */
|
||||||
ctx->flags |= SEEN_SKB | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_A;
|
||||||
off = offsetof(struct sk_buff, len);
|
off = offsetof(struct sk_buff, len);
|
||||||
@@ -1117,7 +1117,7 @@ jmp_cmp:
|
|||||||
case BPF_ANC | SKF_AD_PROTOCOL:
|
case BPF_ANC | SKF_AD_PROTOCOL:
|
||||||
/* A = ntohs(skb->protocol */
|
/* A = ntohs(skb->protocol */
|
||||||
ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A;
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
|
BUILD_BUG_ON(sizeof_field(struct sk_buff,
|
||||||
protocol) != 2);
|
protocol) != 2);
|
||||||
off = offsetof(struct sk_buff, protocol);
|
off = offsetof(struct sk_buff, protocol);
|
||||||
emit_half_load(r_A, r_skb, off, ctx);
|
emit_half_load(r_A, r_skb, off, ctx);
|
||||||
@@ -1142,7 +1142,7 @@ jmp_cmp:
|
|||||||
case BPF_ANC | SKF_AD_CPU:
|
case BPF_ANC | SKF_AD_CPU:
|
||||||
ctx->flags |= SEEN_A | SEEN_OFF;
|
ctx->flags |= SEEN_A | SEEN_OFF;
|
||||||
/* A = current_thread_info()->cpu */
|
/* A = current_thread_info()->cpu */
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info,
|
BUILD_BUG_ON(sizeof_field(struct thread_info,
|
||||||
cpu) != 4);
|
cpu) != 4);
|
||||||
off = offsetof(struct thread_info, cpu);
|
off = offsetof(struct thread_info, cpu);
|
||||||
/* $28/gp points to the thread_info struct */
|
/* $28/gp points to the thread_info struct */
|
||||||
@@ -1163,31 +1163,31 @@ jmp_cmp:
|
|||||||
emit_bcond(MIPS_COND_EQ, r_s0, r_zero, b_off, ctx);
|
emit_bcond(MIPS_COND_EQ, r_s0, r_zero, b_off, ctx);
|
||||||
emit_reg_move(r_ret, r_zero, ctx);
|
emit_reg_move(r_ret, r_zero, ctx);
|
||||||
if (code == (BPF_ANC | SKF_AD_IFINDEX)) {
|
if (code == (BPF_ANC | SKF_AD_IFINDEX)) {
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device, ifindex) != 4);
|
BUILD_BUG_ON(sizeof_field(struct net_device, ifindex) != 4);
|
||||||
off = offsetof(struct net_device, ifindex);
|
off = offsetof(struct net_device, ifindex);
|
||||||
emit_load(r_A, r_s0, off, ctx);
|
emit_load(r_A, r_s0, off, ctx);
|
||||||
} else { /* (code == (BPF_ANC | SKF_AD_HATYPE) */
|
} else { /* (code == (BPF_ANC | SKF_AD_HATYPE) */
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct net_device, type) != 2);
|
BUILD_BUG_ON(sizeof_field(struct net_device, type) != 2);
|
||||||
off = offsetof(struct net_device, type);
|
off = offsetof(struct net_device, type);
|
||||||
emit_half_load_unsigned(r_A, r_s0, off, ctx);
|
emit_half_load_unsigned(r_A, r_s0, off, ctx);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_MARK:
|
case BPF_ANC | SKF_AD_MARK:
|
||||||
ctx->flags |= SEEN_SKB | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_A;
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, mark) != 4);
|
||||||
off = offsetof(struct sk_buff, mark);
|
off = offsetof(struct sk_buff, mark);
|
||||||
emit_load(r_A, r_skb, off, ctx);
|
emit_load(r_A, r_skb, off, ctx);
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_RXHASH:
|
case BPF_ANC | SKF_AD_RXHASH:
|
||||||
ctx->flags |= SEEN_SKB | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_A;
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, hash) != 4);
|
||||||
off = offsetof(struct sk_buff, hash);
|
off = offsetof(struct sk_buff, hash);
|
||||||
emit_load(r_A, r_skb, off, ctx);
|
emit_load(r_A, r_skb, off, ctx);
|
||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_VLAN_TAG:
|
case BPF_ANC | SKF_AD_VLAN_TAG:
|
||||||
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
|
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
|
||||||
ctx->flags |= SEEN_SKB | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_A;
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
|
BUILD_BUG_ON(sizeof_field(struct sk_buff,
|
||||||
vlan_tci) != 2);
|
vlan_tci) != 2);
|
||||||
off = offsetof(struct sk_buff, vlan_tci);
|
off = offsetof(struct sk_buff, vlan_tci);
|
||||||
emit_half_load_unsigned(r_s0, r_skb, off, ctx);
|
emit_half_load_unsigned(r_s0, r_skb, off, ctx);
|
||||||
@@ -1212,7 +1212,7 @@ jmp_cmp:
|
|||||||
break;
|
break;
|
||||||
case BPF_ANC | SKF_AD_QUEUE:
|
case BPF_ANC | SKF_AD_QUEUE:
|
||||||
ctx->flags |= SEEN_SKB | SEEN_A;
|
ctx->flags |= SEEN_SKB | SEEN_A;
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
|
BUILD_BUG_ON(sizeof_field(struct sk_buff,
|
||||||
queue_mapping) != 2);
|
queue_mapping) != 2);
|
||||||
BUILD_BUG_ON(offsetof(struct sk_buff,
|
BUILD_BUG_ON(offsetof(struct sk_buff,
|
||||||
queue_mapping) > 0xff);
|
queue_mapping) > 0xff);
|
||||||
|
|||||||
@@ -101,12 +101,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 thread_info, cpu) != 4); \
|
do { BUILD_BUG_ON(sizeof_field(struct thread_info, cpu) != 4); \
|
||||||
PPC_LHZ_OFFS(r, (1 & ~(THREAD_SIZE - 1)), \
|
PPC_LHZ_OFFS(r, (1 & ~(THREAD_SIZE - 1)), \
|
||||||
offsetof(struct thread_info, cpu)); \
|
offsetof(struct thread_info, cpu)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|||||||
@@ -325,7 +325,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)); */
|
||||||
@@ -337,16 +337,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));
|
||||||
@@ -369,18 +369,18 @@ 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:
|
||||||
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
|
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_tci) != 2);
|
||||||
BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
|
BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
|
||||||
|
|
||||||
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
|
||||||
@@ -393,7 +393,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
|
|||||||
}
|
}
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ static void __init setup_xstate_features(void)
|
|||||||
xstate_offsets[0] = 0;
|
xstate_offsets[0] = 0;
|
||||||
xstate_sizes[0] = offsetof(struct fxregs_state, xmm_space);
|
xstate_sizes[0] = offsetof(struct fxregs_state, xmm_space);
|
||||||
xstate_offsets[1] = xstate_sizes[0];
|
xstate_offsets[1] = xstate_sizes[0];
|
||||||
xstate_sizes[1] = FIELD_SIZEOF(struct fxregs_state, xmm_space);
|
xstate_sizes[1] = sizeof_field(struct fxregs_state, xmm_space);
|
||||||
|
|
||||||
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
|
||||||
if (!xfeature_enabled(i))
|
if (!xfeature_enabled(i))
|
||||||
|
|||||||
@@ -3976,9 +3976,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",
|
||||||
|
|||||||
@@ -437,10 +437,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));
|
||||||
|
|
||||||
|
|||||||
@@ -650,7 +650,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 {
|
||||||
|
|||||||
@@ -831,7 +831,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,
|
||||||
|
|||||||
@@ -105,9 +105,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[] = {
|
||||||
|
|||||||
@@ -1365,7 +1365,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",
|
||||||
|
|||||||
@@ -756,7 +756,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,
|
||||||
@@ -765,55 +765,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,
|
||||||
@@ -831,13 +831,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,
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,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)
|
||||||
|
|||||||
@@ -545,7 +545,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)
|
||||||
|
|||||||
@@ -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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -658,7 +658,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;
|
||||||
|
|||||||
@@ -13,7 +13,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,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[] = {
|
||||||
|
|||||||
@@ -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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1444,11 +1444,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,
|
||||||
|
|||||||
@@ -158,7 +158,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,
|
||||||
@@ -166,7 +166,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,
|
||||||
|
|||||||
@@ -2505,17 +2505,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));
|
||||||
@@ -2536,12 +2536,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));
|
||||||
|
|||||||
@@ -45,7 +45,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,
|
||||||
|
|||||||
@@ -411,7 +411,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)
|
||||||
|
|||||||
@@ -31,7 +31,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), \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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[] = {
|
||||||
|
|||||||
@@ -33,7 +33,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,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[] = {
|
||||||
@@ -170,7 +170,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[] = {
|
||||||
|
|||||||
@@ -789,28 +789,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,7 +963,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,56 +973,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1613,21 +1613,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,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) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1103,7 +1103,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 },
|
||||||
|
|||||||
@@ -588,7 +588,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);
|
||||||
|
|||||||
@@ -883,7 +883,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__);
|
||||||
|
|||||||
@@ -2227,7 +2227,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));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2755,10 +2755,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 },
|
||||||
|
|||||||
@@ -780,7 +780,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 {
|
||||||
|
|||||||
@@ -549,7 +549,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 == ' ')
|
||||||
@@ -588,7 +588,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);
|
||||||
|
|
||||||
|
|||||||
@@ -1305,7 +1305,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
|
||||||
|
|||||||
@@ -2774,7 +2774,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7280,11 +7280,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,
|
||||||
|
|||||||
@@ -1140,109 +1140,109 @@ static int ipipe_get_cgs_params(struct vpfe_ipipe_device *ipipe, void *param)
|
|||||||
static const struct ipipe_module_if ipipe_modules[VPFE_IPIPE_MAX_MODULES] = {
|
static const struct ipipe_module_if ipipe_modules[VPFE_IPIPE_MAX_MODULES] = {
|
||||||
/* VPFE_IPIPE_INPUT_CONFIG */ {
|
/* VPFE_IPIPE_INPUT_CONFIG */ {
|
||||||
offsetof(struct ipipe_module_params, input_config),
|
offsetof(struct ipipe_module_params, input_config),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, input_config),
|
sizeof_field(struct ipipe_module_params, input_config),
|
||||||
offsetof(struct vpfe_ipipe_config, input_config),
|
offsetof(struct vpfe_ipipe_config, input_config),
|
||||||
ipipe_set_input_config,
|
ipipe_set_input_config,
|
||||||
ipipe_get_input_config,
|
ipipe_get_input_config,
|
||||||
}, /* VPFE_IPIPE_LUTDPC */ {
|
}, /* VPFE_IPIPE_LUTDPC */ {
|
||||||
offsetof(struct ipipe_module_params, lutdpc),
|
offsetof(struct ipipe_module_params, lutdpc),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, lutdpc),
|
sizeof_field(struct ipipe_module_params, lutdpc),
|
||||||
offsetof(struct vpfe_ipipe_config, lutdpc),
|
offsetof(struct vpfe_ipipe_config, lutdpc),
|
||||||
ipipe_set_lutdpc_params,
|
ipipe_set_lutdpc_params,
|
||||||
ipipe_get_lutdpc_params,
|
ipipe_get_lutdpc_params,
|
||||||
}, /* VPFE_IPIPE_OTFDPC */ {
|
}, /* VPFE_IPIPE_OTFDPC */ {
|
||||||
offsetof(struct ipipe_module_params, otfdpc),
|
offsetof(struct ipipe_module_params, otfdpc),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, otfdpc),
|
sizeof_field(struct ipipe_module_params, otfdpc),
|
||||||
offsetof(struct vpfe_ipipe_config, otfdpc),
|
offsetof(struct vpfe_ipipe_config, otfdpc),
|
||||||
ipipe_set_otfdpc_params,
|
ipipe_set_otfdpc_params,
|
||||||
ipipe_get_otfdpc_params,
|
ipipe_get_otfdpc_params,
|
||||||
}, /* VPFE_IPIPE_NF1 */ {
|
}, /* VPFE_IPIPE_NF1 */ {
|
||||||
offsetof(struct ipipe_module_params, nf1),
|
offsetof(struct ipipe_module_params, nf1),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, nf1),
|
sizeof_field(struct ipipe_module_params, nf1),
|
||||||
offsetof(struct vpfe_ipipe_config, nf1),
|
offsetof(struct vpfe_ipipe_config, nf1),
|
||||||
ipipe_set_nf1_params,
|
ipipe_set_nf1_params,
|
||||||
ipipe_get_nf1_params,
|
ipipe_get_nf1_params,
|
||||||
}, /* VPFE_IPIPE_NF2 */ {
|
}, /* VPFE_IPIPE_NF2 */ {
|
||||||
offsetof(struct ipipe_module_params, nf2),
|
offsetof(struct ipipe_module_params, nf2),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, nf2),
|
sizeof_field(struct ipipe_module_params, nf2),
|
||||||
offsetof(struct vpfe_ipipe_config, nf2),
|
offsetof(struct vpfe_ipipe_config, nf2),
|
||||||
ipipe_set_nf2_params,
|
ipipe_set_nf2_params,
|
||||||
ipipe_get_nf2_params,
|
ipipe_get_nf2_params,
|
||||||
}, /* VPFE_IPIPE_WB */ {
|
}, /* VPFE_IPIPE_WB */ {
|
||||||
offsetof(struct ipipe_module_params, wbal),
|
offsetof(struct ipipe_module_params, wbal),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, wbal),
|
sizeof_field(struct ipipe_module_params, wbal),
|
||||||
offsetof(struct vpfe_ipipe_config, wbal),
|
offsetof(struct vpfe_ipipe_config, wbal),
|
||||||
ipipe_set_wb_params,
|
ipipe_set_wb_params,
|
||||||
ipipe_get_wb_params,
|
ipipe_get_wb_params,
|
||||||
}, /* VPFE_IPIPE_RGB2RGB_1 */ {
|
}, /* VPFE_IPIPE_RGB2RGB_1 */ {
|
||||||
offsetof(struct ipipe_module_params, rgb2rgb1),
|
offsetof(struct ipipe_module_params, rgb2rgb1),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, rgb2rgb1),
|
sizeof_field(struct ipipe_module_params, rgb2rgb1),
|
||||||
offsetof(struct vpfe_ipipe_config, rgb2rgb1),
|
offsetof(struct vpfe_ipipe_config, rgb2rgb1),
|
||||||
ipipe_set_rgb2rgb_1_params,
|
ipipe_set_rgb2rgb_1_params,
|
||||||
ipipe_get_rgb2rgb_1_params,
|
ipipe_get_rgb2rgb_1_params,
|
||||||
}, /* VPFE_IPIPE_RGB2RGB_2 */ {
|
}, /* VPFE_IPIPE_RGB2RGB_2 */ {
|
||||||
offsetof(struct ipipe_module_params, rgb2rgb2),
|
offsetof(struct ipipe_module_params, rgb2rgb2),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, rgb2rgb2),
|
sizeof_field(struct ipipe_module_params, rgb2rgb2),
|
||||||
offsetof(struct vpfe_ipipe_config, rgb2rgb2),
|
offsetof(struct vpfe_ipipe_config, rgb2rgb2),
|
||||||
ipipe_set_rgb2rgb_2_params,
|
ipipe_set_rgb2rgb_2_params,
|
||||||
ipipe_get_rgb2rgb_2_params,
|
ipipe_get_rgb2rgb_2_params,
|
||||||
}, /* VPFE_IPIPE_GAMMA */ {
|
}, /* VPFE_IPIPE_GAMMA */ {
|
||||||
offsetof(struct ipipe_module_params, gamma),
|
offsetof(struct ipipe_module_params, gamma),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, gamma),
|
sizeof_field(struct ipipe_module_params, gamma),
|
||||||
offsetof(struct vpfe_ipipe_config, gamma),
|
offsetof(struct vpfe_ipipe_config, gamma),
|
||||||
ipipe_set_gamma_params,
|
ipipe_set_gamma_params,
|
||||||
ipipe_get_gamma_params,
|
ipipe_get_gamma_params,
|
||||||
}, /* VPFE_IPIPE_3D_LUT */ {
|
}, /* VPFE_IPIPE_3D_LUT */ {
|
||||||
offsetof(struct ipipe_module_params, lut),
|
offsetof(struct ipipe_module_params, lut),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, lut),
|
sizeof_field(struct ipipe_module_params, lut),
|
||||||
offsetof(struct vpfe_ipipe_config, lut),
|
offsetof(struct vpfe_ipipe_config, lut),
|
||||||
ipipe_set_3d_lut_params,
|
ipipe_set_3d_lut_params,
|
||||||
ipipe_get_3d_lut_params,
|
ipipe_get_3d_lut_params,
|
||||||
}, /* VPFE_IPIPE_RGB2YUV */ {
|
}, /* VPFE_IPIPE_RGB2YUV */ {
|
||||||
offsetof(struct ipipe_module_params, rgb2yuv),
|
offsetof(struct ipipe_module_params, rgb2yuv),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, rgb2yuv),
|
sizeof_field(struct ipipe_module_params, rgb2yuv),
|
||||||
offsetof(struct vpfe_ipipe_config, rgb2yuv),
|
offsetof(struct vpfe_ipipe_config, rgb2yuv),
|
||||||
ipipe_set_rgb2yuv_params,
|
ipipe_set_rgb2yuv_params,
|
||||||
ipipe_get_rgb2yuv_params,
|
ipipe_get_rgb2yuv_params,
|
||||||
}, /* VPFE_IPIPE_YUV422_CONV */ {
|
}, /* VPFE_IPIPE_YUV422_CONV */ {
|
||||||
offsetof(struct ipipe_module_params, yuv422_conv),
|
offsetof(struct ipipe_module_params, yuv422_conv),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, yuv422_conv),
|
sizeof_field(struct ipipe_module_params, yuv422_conv),
|
||||||
offsetof(struct vpfe_ipipe_config, yuv422_conv),
|
offsetof(struct vpfe_ipipe_config, yuv422_conv),
|
||||||
ipipe_set_yuv422_conv_params,
|
ipipe_set_yuv422_conv_params,
|
||||||
ipipe_get_yuv422_conv_params,
|
ipipe_get_yuv422_conv_params,
|
||||||
}, /* VPFE_IPIPE_YEE */ {
|
}, /* VPFE_IPIPE_YEE */ {
|
||||||
offsetof(struct ipipe_module_params, yee),
|
offsetof(struct ipipe_module_params, yee),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, yee),
|
sizeof_field(struct ipipe_module_params, yee),
|
||||||
offsetof(struct vpfe_ipipe_config, yee),
|
offsetof(struct vpfe_ipipe_config, yee),
|
||||||
ipipe_set_yee_params,
|
ipipe_set_yee_params,
|
||||||
ipipe_get_yee_params,
|
ipipe_get_yee_params,
|
||||||
}, /* VPFE_IPIPE_GIC */ {
|
}, /* VPFE_IPIPE_GIC */ {
|
||||||
offsetof(struct ipipe_module_params, gic),
|
offsetof(struct ipipe_module_params, gic),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, gic),
|
sizeof_field(struct ipipe_module_params, gic),
|
||||||
offsetof(struct vpfe_ipipe_config, gic),
|
offsetof(struct vpfe_ipipe_config, gic),
|
||||||
ipipe_set_gic_params,
|
ipipe_set_gic_params,
|
||||||
ipipe_get_gic_params,
|
ipipe_get_gic_params,
|
||||||
}, /* VPFE_IPIPE_CFA */ {
|
}, /* VPFE_IPIPE_CFA */ {
|
||||||
offsetof(struct ipipe_module_params, cfa),
|
offsetof(struct ipipe_module_params, cfa),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, cfa),
|
sizeof_field(struct ipipe_module_params, cfa),
|
||||||
offsetof(struct vpfe_ipipe_config, cfa),
|
offsetof(struct vpfe_ipipe_config, cfa),
|
||||||
ipipe_set_cfa_params,
|
ipipe_set_cfa_params,
|
||||||
ipipe_get_cfa_params,
|
ipipe_get_cfa_params,
|
||||||
}, /* VPFE_IPIPE_CAR */ {
|
}, /* VPFE_IPIPE_CAR */ {
|
||||||
offsetof(struct ipipe_module_params, car),
|
offsetof(struct ipipe_module_params, car),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, car),
|
sizeof_field(struct ipipe_module_params, car),
|
||||||
offsetof(struct vpfe_ipipe_config, car),
|
offsetof(struct vpfe_ipipe_config, car),
|
||||||
ipipe_set_car_params,
|
ipipe_set_car_params,
|
||||||
ipipe_get_car_params,
|
ipipe_get_car_params,
|
||||||
}, /* VPFE_IPIPE_CGS */ {
|
}, /* VPFE_IPIPE_CGS */ {
|
||||||
offsetof(struct ipipe_module_params, cgs),
|
offsetof(struct ipipe_module_params, cgs),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, cgs),
|
sizeof_field(struct ipipe_module_params, cgs),
|
||||||
offsetof(struct vpfe_ipipe_config, cgs),
|
offsetof(struct vpfe_ipipe_config, cgs),
|
||||||
ipipe_set_cgs_params,
|
ipipe_set_cgs_params,
|
||||||
ipipe_get_cgs_params,
|
ipipe_get_cgs_params,
|
||||||
}, /* VPFE_IPIPE_GBCE */ {
|
}, /* VPFE_IPIPE_GBCE */ {
|
||||||
offsetof(struct ipipe_module_params, gbce),
|
offsetof(struct ipipe_module_params, gbce),
|
||||||
FIELD_SIZEOF(struct ipipe_module_params, gbce),
|
sizeof_field(struct ipipe_module_params, gbce),
|
||||||
offsetof(struct vpfe_ipipe_config, gbce),
|
offsetof(struct vpfe_ipipe_config, gbce),
|
||||||
ipipe_set_gbce_params,
|
ipipe_set_gbce_params,
|
||||||
ipipe_get_gbce_params,
|
ipipe_get_gbce_params,
|
||||||
|
|||||||
@@ -710,7 +710,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3575,7 +3575,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,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)
|
||||||
|
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ struct metadata_handler {
|
|||||||
struct metadata_handler *handler);
|
struct metadata_handler *handler);
|
||||||
};
|
};
|
||||||
#define INCFS_MAX_METADATA_RECORD_SIZE \
|
#define INCFS_MAX_METADATA_RECORD_SIZE \
|
||||||
FIELD_SIZEOF(struct metadata_handler, md_buffer)
|
sizeof_field(struct metadata_handler, md_buffer)
|
||||||
|
|
||||||
/* Backing file context management */
|
/* Backing file context management */
|
||||||
struct mount_info;
|
struct mount_info;
|
||||||
|
|||||||
@@ -355,7 +355,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)
|
||||||
|
|||||||
@@ -460,7 +460,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; \
|
||||||
})
|
})
|
||||||
@@ -540,7 +540,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); \
|
||||||
})
|
})
|
||||||
@@ -685,7 +685,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);
|
||||||
}
|
}
|
||||||
@@ -723,9 +723,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,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)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ struct phy_device;
|
|||||||
#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 10
|
#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 10
|
||||||
|
|
||||||
#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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,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);
|
||||||
|
|||||||
@@ -38,7 +38,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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2394,7 +2394,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),
|
||||||
.locks_mul = 1,
|
.locks_mul = 1,
|
||||||
.automatic_shrinking = true,
|
.automatic_shrinking = true,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1757,7 +1757,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;
|
||||||
|
|||||||
@@ -539,7 +539,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);
|
||||||
@@ -564,7 +564,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);
|
||||||
@@ -712,7 +712,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)
|
||||||
|
|||||||
@@ -562,7 +562,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 */
|
||||||
|
|||||||
@@ -202,7 +202,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) {
|
||||||
|
|||||||
@@ -10209,7 +10209,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);
|
||||||
|
|||||||
@@ -307,7 +307,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));
|
||||||
@@ -322,7 +322,7 @@ 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));
|
||||||
@@ -330,7 +330,7 @@ static u32 convert_skb_access(int skb_field, int dst_reg, int src_reg,
|
|||||||
|
|
||||||
case SKF_AD_VLAN_TAG:
|
case SKF_AD_VLAN_TAG:
|
||||||
case SKF_AD_VLAN_TAG_PRESENT:
|
case SKF_AD_VLAN_TAG_PRESENT:
|
||||||
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
|
BUILD_BUG_ON(sizeof_field(struct sk_buff, vlan_tci) != 2);
|
||||||
BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
|
BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
|
||||||
|
|
||||||
/* dst_reg = *(u16 *) (src_reg + offsetof(vlan_tci)) */
|
/* dst_reg = *(u16 *) (src_reg + offsetof(vlan_tci)) */
|
||||||
@@ -359,7 +359,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,
|
||||||
@@ -375,8 +375,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,
|
||||||
@@ -398,7 +398,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));
|
||||||
@@ -422,7 +422,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,
|
||||||
@@ -6331,8 +6331,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)); \
|
||||||
@@ -6340,9 +6340,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), \
|
||||||
@@ -6357,7 +6357,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));
|
||||||
@@ -6522,8 +6522,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)); \
|
||||||
@@ -8487,7 +8487,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));
|
||||||
@@ -8506,7 +8506,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);
|
||||||
@@ -8577,7 +8577,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,
|
||||||
@@ -8588,7 +8588,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,
|
||||||
@@ -8599,7 +8599,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),
|
||||||
@@ -8613,7 +8613,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;
|
||||||
@@ -8633,7 +8633,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;
|
||||||
@@ -8652,7 +8652,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,
|
||||||
@@ -8667,7 +8667,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,
|
||||||
@@ -8678,7 +8678,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,
|
||||||
@@ -8711,7 +8711,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);
|
||||||
@@ -8741,7 +8741,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,
|
||||||
@@ -8752,7 +8752,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,
|
||||||
@@ -8763,7 +8763,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,
|
||||||
@@ -8779,7 +8779,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;
|
||||||
@@ -8806,7 +8806,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;
|
||||||
@@ -8815,7 +8815,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;
|
||||||
@@ -8829,7 +8829,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
|
||||||
@@ -8846,7 +8846,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
|
||||||
@@ -8860,7 +8860,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;
|
||||||
@@ -8870,7 +8870,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;
|
||||||
@@ -8880,7 +8880,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;
|
||||||
@@ -9002,7 +9002,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)
|
||||||
@@ -9033,7 +9033,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, \
|
||||||
@@ -9095,8 +9095,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));
|
||||||
/* Account for sin6_port being smaller than user_port. */
|
/* Account for sin6_port being smaller than user_port. */
|
||||||
port_size = min(port_size, BPF_LDST_BYTES(si));
|
port_size = min(port_size, BPF_LDST_BYTES(si));
|
||||||
SOCK_ADDR_LOAD_OR_STORE_NESTED_FIELD_SIZE_OFF(
|
SOCK_ADDR_LOAD_OR_STORE_NESTED_FIELD_SIZE_OFF(
|
||||||
@@ -9250,8 +9250,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) \
|
||||||
@@ -9299,10 +9299,10 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
|
|||||||
|
|
||||||
case offsetof(struct bpf_sock_ops, replylong[0]) ...
|
case offsetof(struct bpf_sock_ops, replylong[0]) ...
|
||||||
offsetof(struct bpf_sock_ops, replylong[3]):
|
offsetof(struct bpf_sock_ops, replylong[3]):
|
||||||
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, replylong[0]);
|
off -= offsetof(struct bpf_sock_ops, replylong[0]);
|
||||||
off += offsetof(struct bpf_sock_ops_kern, replylong[0]);
|
off += offsetof(struct bpf_sock_ops_kern, replylong[0]);
|
||||||
@@ -9315,7 +9315,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),
|
||||||
@@ -9326,7 +9326,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),
|
||||||
@@ -9337,7 +9337,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(
|
||||||
@@ -9352,7 +9352,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;
|
||||||
@@ -9373,7 +9373,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;
|
||||||
@@ -9392,7 +9392,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),
|
||||||
@@ -9406,7 +9406,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),
|
||||||
@@ -9426,7 +9426,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),
|
||||||
@@ -9437,7 +9437,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));
|
||||||
@@ -9448,7 +9448,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):
|
||||||
@@ -9644,7 +9644,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),
|
||||||
@@ -9655,7 +9655,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),
|
||||||
@@ -9666,7 +9666,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(
|
||||||
@@ -9681,7 +9681,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;
|
||||||
@@ -9702,7 +9702,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;
|
||||||
@@ -9721,7 +9721,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),
|
||||||
@@ -9735,7 +9735,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),
|
||||||
@@ -10135,7 +10135,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):
|
||||||
@@ -10153,7 +10153,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)); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,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 */
|
||||||
@@ -66,7 +66,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,
|
||||||
|
|||||||
@@ -1151,7 +1151,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;
|
||||||
|
|||||||
@@ -1593,8 +1593,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 },
|
||||||
|
|||||||
@@ -631,8 +631,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 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3932,7 +3932,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);
|
||||||
|
|||||||
@@ -2223,8 +2223,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 },
|
||||||
|
|||||||
@@ -7513,7 +7513,7 @@ static 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;
|
||||||
@@ -7582,7 +7582,7 @@ static 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;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -238,7 +238,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,12 +429,12 @@ static int nft_ct_get_init(const struct nft_ctx *ctx,
|
|||||||
|
|
||||||
switch (ctx->family) {
|
switch (ctx->family) {
|
||||||
case NFPROTO_IPV4:
|
case NFPROTO_IPV4:
|
||||||
len = FIELD_SIZEOF(struct nf_conntrack_tuple,
|
len = sizeof_field(struct nf_conntrack_tuple,
|
||||||
src.u3.ip);
|
src.u3.ip);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
case NFPROTO_INET:
|
case NFPROTO_INET:
|
||||||
len = FIELD_SIZEOF(struct nf_conntrack_tuple,
|
len = sizeof_field(struct nf_conntrack_tuple,
|
||||||
src.u3.ip6);
|
src.u3.ip6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -446,20 +446,20 @@ static int nft_ct_get_init(const struct nft_ctx *ctx,
|
|||||||
if (tb[NFTA_CT_DIRECTION] == NULL)
|
if (tb[NFTA_CT_DIRECTION] == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
len = FIELD_SIZEOF(struct nf_conntrack_tuple, src.u3.ip);
|
len = sizeof_field(struct nf_conntrack_tuple, src.u3.ip);
|
||||||
break;
|
break;
|
||||||
case NFT_CT_SRC_IP6:
|
case NFT_CT_SRC_IP6:
|
||||||
case NFT_CT_DST_IP6:
|
case NFT_CT_DST_IP6:
|
||||||
if (tb[NFTA_CT_DIRECTION] == NULL)
|
if (tb[NFTA_CT_DIRECTION] == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
len = FIELD_SIZEOF(struct nf_conntrack_tuple, src.u3.ip6);
|
len = sizeof_field(struct nf_conntrack_tuple, src.u3.ip6);
|
||||||
break;
|
break;
|
||||||
case NFT_CT_PROTO_SRC:
|
case NFT_CT_PROTO_SRC:
|
||||||
case NFT_CT_PROTO_DST:
|
case NFT_CT_PROTO_DST:
|
||||||
if (tb[NFTA_CT_DIRECTION] == NULL)
|
if (tb[NFTA_CT_DIRECTION] == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
len = FIELD_SIZEOF(struct nf_conntrack_tuple, src.u.all);
|
len = sizeof_field(struct nf_conntrack_tuple, src.u.all);
|
||||||
break;
|
break;
|
||||||
case NFT_CT_BYTES:
|
case NFT_CT_BYTES:
|
||||||
case NFT_CT_PKTS:
|
case NFT_CT_PKTS:
|
||||||
@@ -536,7 +536,7 @@ static int nft_ct_set_init(const struct nft_ctx *ctx,
|
|||||||
case NFT_CT_MARK:
|
case NFT_CT_MARK:
|
||||||
if (tb[NFTA_CT_DIRECTION])
|
if (tb[NFTA_CT_DIRECTION])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
len = FIELD_SIZEOF(struct nf_conn, mark);
|
len = sizeof_field(struct nf_conn, mark);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NF_CONNTRACK_LABELS
|
#ifdef CONFIG_NF_CONNTRACK_LABELS
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ int nft_masq_init(const struct nft_ctx *ctx,
|
|||||||
const struct nft_expr *expr,
|
const struct nft_expr *expr,
|
||||||
const struct nlattr * const tb[])
|
const struct nlattr * const tb[])
|
||||||
{
|
{
|
||||||
u32 plen = FIELD_SIZEOF(struct nf_nat_range, min_addr.all);
|
u32 plen = sizeof_field(struct nf_nat_range, min_addr.all);
|
||||||
struct nft_masq *priv = nft_expr_priv(expr);
|
struct nft_masq *priv = nft_expr_priv(expr);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|||||||
@@ -152,10 +152,10 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
|
|||||||
|
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case NFPROTO_IPV4:
|
case NFPROTO_IPV4:
|
||||||
alen = FIELD_SIZEOF(struct nf_nat_range, min_addr.ip);
|
alen = sizeof_field(struct nf_nat_range, min_addr.ip);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
alen = FIELD_SIZEOF(struct nf_nat_range, min_addr.ip6);
|
alen = sizeof_field(struct nf_nat_range, min_addr.ip6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (tb[NFTA_NAT_REG_ADDR_MIN])
|
if (tb[NFTA_NAT_REG_ADDR_MIN])
|
||||||
@@ -181,7 +181,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plen = FIELD_SIZEOF(struct nf_nat_range, min_addr.all);
|
plen = sizeof_field(struct nf_nat_range, min_addr.all);
|
||||||
if (tb[NFTA_NAT_REG_PROTO_MIN]) {
|
if (tb[NFTA_NAT_REG_PROTO_MIN]) {
|
||||||
err = nft_parse_register_load(tb[NFTA_NAT_REG_PROTO_MIN],
|
err = nft_parse_register_load(tb[NFTA_NAT_REG_PROTO_MIN],
|
||||||
&priv->sreg_proto_min, plen);
|
&priv->sreg_proto_min, plen);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ int nft_redir_init(const struct nft_ctx *ctx,
|
|||||||
unsigned int plen;
|
unsigned int plen;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
plen = FIELD_SIZEOF(struct nf_nat_range, min_addr.all);
|
plen = sizeof_field(struct nf_nat_range, min_addr.all);
|
||||||
if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
|
if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
|
||||||
err = nft_parse_register_load(tb[NFTA_REDIR_REG_PROTO_MIN],
|
err = nft_parse_register_load(tb[NFTA_REDIR_REG_PROTO_MIN],
|
||||||
&priv->sreg_proto_min, plen);
|
&priv->sreg_proto_min, plen);
|
||||||
|
|||||||
@@ -225,14 +225,14 @@ static int nft_tproxy_init(const struct nft_ctx *ctx,
|
|||||||
|
|
||||||
switch (priv->family) {
|
switch (priv->family) {
|
||||||
case NFPROTO_IPV4:
|
case NFPROTO_IPV4:
|
||||||
alen = FIELD_SIZEOF(union nf_inet_addr, in);
|
alen = sizeof_field(union nf_inet_addr, in);
|
||||||
err = nf_defrag_ipv4_enable(ctx->net);
|
err = nf_defrag_ipv4_enable(ctx->net);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
break;
|
break;
|
||||||
#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
|
#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
alen = FIELD_SIZEOF(union nf_inet_addr, in6);
|
alen = sizeof_field(union nf_inet_addr, in6);
|
||||||
err = nf_defrag_ipv6_enable(ctx->net);
|
err = nf_defrag_ipv6_enable(ctx->net);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ static unsigned int jhash_rnd __read_mostly;
|
|||||||
|
|
||||||
static unsigned int xt_rateest_hash(const char *name)
|
static unsigned int xt_rateest_hash(const char *name)
|
||||||
{
|
{
|
||||||
return jhash(name, FIELD_SIZEOF(struct xt_rateest, name), jhash_rnd) &
|
return jhash(name, sizeof_field(struct xt_rateest, name), jhash_rnd) &
|
||||||
(RATEEST_HSIZE - 1);
|
(RATEEST_HSIZE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2857,7 +2857,7 @@ static int __init netlink_proto_init(void)
|
|||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct netlink_skb_parms) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(struct netlink_skb_parms) > sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL);
|
nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL);
|
||||||
if (!nl_table)
|
if (!nl_table)
|
||||||
|
|||||||
@@ -2430,7 +2430,7 @@ static int __init dp_init(void)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
pr_info("Open vSwitch switching datapath\n");
|
pr_info("Open vSwitch switching datapath\n");
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ enum sw_flow_mac_proto {
|
|||||||
* matching for small options.
|
* matching for small options.
|
||||||
*/
|
*/
|
||||||
#define TUN_METADATA_OFFSET(opt_len) \
|
#define TUN_METADATA_OFFSET(opt_len) \
|
||||||
(FIELD_SIZEOF(struct sw_flow_key, tun_opts) - opt_len)
|
(sizeof_field(struct sw_flow_key, tun_opts) - opt_len)
|
||||||
#define TUN_METADATA_OPTS(flow_key, opt_len) \
|
#define TUN_METADATA_OPTS(flow_key, opt_len) \
|
||||||
((void *)((flow_key)->tun_opts + TUN_METADATA_OFFSET(opt_len)))
|
((void *)((flow_key)->tun_opts + TUN_METADATA_OFFSET(opt_len)))
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ struct vlan_head {
|
|||||||
|
|
||||||
#define OVS_SW_FLOW_KEY_METADATA_SIZE \
|
#define OVS_SW_FLOW_KEY_METADATA_SIZE \
|
||||||
(offsetof(struct sw_flow_key, recirc_id) + \
|
(offsetof(struct sw_flow_key, recirc_id) + \
|
||||||
FIELD_SIZEOF(struct sw_flow_key, recirc_id))
|
sizeof_field(struct sw_flow_key, recirc_id))
|
||||||
|
|
||||||
struct ovs_key_nsh {
|
struct ovs_key_nsh {
|
||||||
struct ovs_nsh_key_base base;
|
struct ovs_nsh_key_base base;
|
||||||
|
|||||||
@@ -981,7 +981,7 @@ static int __init af_rxrpc_init(void)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
get_random_bytes(&tmp, sizeof(tmp));
|
get_random_bytes(&tmp, sizeof(tmp));
|
||||||
tmp &= 0x3fffffff;
|
tmp &= 0x3fffffff;
|
||||||
|
|||||||
@@ -2936,7 +2936,7 @@ static int __init af_unix_init(void)
|
|||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct unix_skb_parms) > FIELD_SIZEOF(struct sk_buff, cb));
|
BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof_field(struct sk_buff, cb));
|
||||||
|
|
||||||
rc = proto_register(&unix_proto, 1);
|
rc = proto_register(&unix_proto, 1);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
#define DONT_HASH 0x0200
|
#define DONT_HASH 0x0200
|
||||||
|
|
||||||
#define INVALID_PCR(a) (((a) < 0) || \
|
#define INVALID_PCR(a) (((a) < 0) || \
|
||||||
(a) >= (FIELD_SIZEOF(struct integrity_iint_cache, measured_pcrs) * 8))
|
(a) >= (sizeof_field(struct integrity_iint_cache, measured_pcrs) * 8))
|
||||||
|
|
||||||
int ima_policy_flag;
|
int ima_policy_flag;
|
||||||
static int temp_ima_appraise;
|
static int temp_ima_appraise;
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ static int hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
|
||||||
uinfo->count = FIELD_SIZEOF(struct hdmi_codec_priv, eld);
|
uinfo->count = sizeof_field(struct hdmi_codec_priv, eld);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user